[COLLECTIONS-231] apply signature change to factory method.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1353165 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7f0c6e905a
commit
3293227598
|
@ -61,7 +61,8 @@ public class PredicatedCollection<E> extends AbstractCollectionDecorator<E> {
|
|||
* @throws IllegalArgumentException if collection or predicate is null
|
||||
* @throws IllegalArgumentException if the collection contains invalid elements
|
||||
*/
|
||||
public static <T> Collection<T> predicatedCollection(Collection<T> coll, Predicate<? super T> predicate) {
|
||||
public static <T> PredicatedCollection<T> predicatedCollection(Collection<T> coll,
|
||||
Predicate<? super T> predicate) {
|
||||
return new PredicatedCollection<T>(coll, predicate);
|
||||
}
|
||||
|
||||
|
@ -99,7 +100,8 @@ public class PredicatedCollection<E> extends AbstractCollectionDecorator<E> {
|
|||
*/
|
||||
protected void validate(E object) {
|
||||
if (predicate.evaluate(object) == false) {
|
||||
throw new IllegalArgumentException("Cannot add Object '" + object + "' - Predicate '" + predicate + "' rejected it");
|
||||
throw new IllegalArgumentException("Cannot add Object '" + object + "' - Predicate '" +
|
||||
predicate + "' rejected it");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ public class SynchronizedCollection<E> implements Collection<E>, Serializable {
|
|||
* @return a new synchronized collection
|
||||
* @throws IllegalArgumentException if collection is null
|
||||
*/
|
||||
public static <T> Collection<T> synchronizedCollection(Collection<T> coll) {
|
||||
public static <T> SynchronizedCollection<T> synchronizedCollection(Collection<T> coll) {
|
||||
return new SynchronizedCollection<T>(coll);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,12 +53,14 @@ public class TransformedCollection<E> extends AbstractCollectionDecorator<E> {
|
|||
* are NOT transformed.
|
||||
* Contrast this with {@link #transformedCollection(Collection, Transformer)}.
|
||||
*
|
||||
* @param <E> the type of the elements in the collection
|
||||
* @param coll the collection to decorate, must not be null
|
||||
* @param transformer the transformer to use for conversion, must not be null
|
||||
* @return a new transformed collection
|
||||
* @throws IllegalArgumentException if collection or transformer is null
|
||||
*/
|
||||
public static <E> Collection<E> transformingCollection(Collection<E> coll, Transformer<? super E, ? extends E> transformer) {
|
||||
public static <E> TransformedCollection<E> transformingCollection(Collection<E> coll,
|
||||
Transformer<? super E, ? extends E> transformer) {
|
||||
return new TransformedCollection<E>(coll, transformer);
|
||||
}
|
||||
|
||||
|
@ -70,13 +72,15 @@ public class TransformedCollection<E> extends AbstractCollectionDecorator<E> {
|
|||
* will be transformed by this method.
|
||||
* Contrast this with {@link #transformingCollection(Collection, Transformer)}.
|
||||
*
|
||||
* @param <E> the type of the elements in the collection
|
||||
* @param collection the collection to decorate, must not be null
|
||||
* @param transformer the transformer to use for conversion, must not be null
|
||||
* @return a new transformed Collection
|
||||
* @throws IllegalArgumentException if collection or transformer is null
|
||||
* @since Commons Collections 3.3
|
||||
*/
|
||||
public static <E> Collection<E> transformedCollection(Collection<E> collection, Transformer<? super E, ? extends E> transformer) {
|
||||
public static <E> TransformedCollection<E> transformedCollection(Collection<E> collection,
|
||||
Transformer<? super E, ? extends E> transformer) {
|
||||
TransformedCollection<E> decorated = new TransformedCollection<E>(collection, transformer);
|
||||
// null collection & transformer are disallowed by the constructor call above
|
||||
if (collection.size() > 0) {
|
||||
|
|
|
@ -50,6 +50,7 @@ public final class UnmodifiableBoundedCollection<E> extends AbstractCollectionDe
|
|||
/**
|
||||
* Factory method to create an unmodifiable bounded collection.
|
||||
*
|
||||
* @param <E> the type of the elements in the collection
|
||||
* @param coll the <code>BoundedCollection</code> to decorate, must not be null
|
||||
* @return a new unmodifiable bounded collection
|
||||
* @throws IllegalArgumentException if {@code coll} is {@code null}
|
||||
|
@ -64,6 +65,7 @@ public final class UnmodifiableBoundedCollection<E> extends AbstractCollectionDe
|
|||
* This method is capable of drilling down through up to 1000 other decorators
|
||||
* to find a suitable BoundedCollection.
|
||||
*
|
||||
* @param <E> the type of the elements in the collection
|
||||
* @param coll the <code>BoundedCollection</code> to decorate, must not be null
|
||||
* @return a new unmodifiable bounded collection
|
||||
* @throws IllegalArgumentException if {@code coll} is {@code null}
|
||||
|
|
Loading…
Reference in New Issue