COLLECTIONS-458 AbstractUntypedCollectionDecorator<E, D> is not used

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1477514 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2013-04-30 09:03:12 +00:00
parent 44dc835e0a
commit 40ad5dc2db
2 changed files with 3 additions and 137 deletions

View File

@ -22,6 +22,9 @@
<body>
<release version="4.0" date="TBA" description="Next release">
<action issue="COLLECTIONS-458" dev="tn" type="delete">
AbstractUntypedCollectionDecorator<E, D> is not used.
</action>
<action issue="COLLECTIONS-456" dev="tn" type="add">
Added method "ListUtils#longestCommonSubsequence(List, List)".
</action>

View File

@ -1,137 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.collections4.collection;
import java.io.Serializable;
import java.util.Collection;
/**
* Decorates another <code>Collection</code> to provide additional behaviour
* without guaranteeing that the provided <code>Collection</code> type is the
* same as that of the decorated <code>Collection</code>.
* <p>
* Each untyped method call made on this <code>Collection</code> is forwarded to the
* decorated <code>Collection</code>. This class is used as a framework on which
* to build to extensions such as synchronized and unmodifiable behaviour. The
* main advantage of decoration is that one decorator can wrap any
* implementation of <code>Collection</code>, whereas sub-classing requires a
* new class to be written for each implementation.
* <p>
* This implementation does not perform any special processing with
* {@link #iterator()}. Instead it simply returns the value from the wrapped
* collection. This may be undesirable, for example if you are trying to write
* an unmodifiable implementation it might provide a loophole.
*
* @param <D> the type of the elements in the decorated collection
* @param <E> the element type of the Collection implementation
* @since 4.0
* @version $Id$
*/
public abstract class AbstractUntypedCollectionDecorator<E, D> implements Collection<E>, Serializable {
/** Serialization version */
private static final long serialVersionUID = -8016691444524268856L;
/** The collection being decorated */
protected Collection<D> collection;
/**
* Create a new AbstractUntypedCollectionDecorator.
*/
public AbstractUntypedCollectionDecorator() {
super();
}
/**
* Constructor that wraps (not copies).
*
* @param coll the collection to decorate, must not be null
* @throws IllegalArgumentException if the collection is null
*/
protected AbstractUntypedCollectionDecorator(final Collection<D> coll) {
if (coll == null) {
throw new IllegalArgumentException("Collection must not be null");
}
this.collection = coll;
}
/**
* Gets the collection being decorated. All access to the decorated
* collection goes via this method.
*
* @return the decorated collection
*/
protected Collection<D> decorated() {
return collection;
}
public void clear() {
decorated().clear();
}
public boolean contains(final Object object) {
return decorated().contains(object);
}
public boolean isEmpty() {
return decorated().isEmpty();
}
public boolean remove(final Object object) {
return decorated().remove(object);
}
public int size() {
return decorated().size();
}
public Object[] toArray() {
return decorated().toArray();
}
public <T> T[] toArray(final T[] object) {
return decorated().toArray(object);
}
public boolean containsAll(final Collection<?> coll) {
return decorated().containsAll(coll);
}
public boolean removeAll(final Collection<?> coll) {
return decorated().removeAll(coll);
}
public boolean retainAll(final Collection<?> coll) {
return decorated().retainAll(coll);
}
@Override
public boolean equals(final Object object) {
return object == this || decorated().equals(object);
}
@Override
public int hashCode() {
return decorated().hashCode();
}
@Override
public String toString() {
return decorated().toString();
}
}