[COLLECTIONS-231] apply signature change to factory method.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1353169 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5d40178770
commit
7c8c58f146
|
@ -51,21 +51,27 @@ public final class MapBackedSet<E, V> implements Set<E>, Serializable {
|
|||
/**
|
||||
* Factory method to create a set from a map.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param <V> the dummy value type in the map
|
||||
* @param map the map to decorate, must not be null
|
||||
* @return a new map backed set
|
||||
* @throws IllegalArgumentException if set is null
|
||||
*/
|
||||
public static <E, V> Set<E> mapBackedSet(Map<E, ? super V> map) {
|
||||
public static <E, V> MapBackedSet<E, V> mapBackedSet(Map<E, ? super V> map) {
|
||||
return mapBackedSet(map, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method to create a set from a map.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param <V> the dummy value type in the map
|
||||
* @param map the map to decorate, must not be null
|
||||
* @param dummyValue the dummy value to use
|
||||
* @return a new map backed set
|
||||
* @throws IllegalArgumentException if map is null
|
||||
*/
|
||||
public static <E, V> Set<E> mapBackedSet(Map<E, ? super V> map, V dummyValue) {
|
||||
public static <E, V> MapBackedSet<E, V> mapBackedSet(Map<E, ? super V> map, V dummyValue) {
|
||||
if (map == null) {
|
||||
throw new IllegalArgumentException("The map must not be null");
|
||||
}
|
||||
|
|
|
@ -51,14 +51,15 @@ public class PredicatedSet<E> extends PredicatedCollection<E> implements Set<E>
|
|||
* If there are any elements already in the set being decorated, they
|
||||
* are validated.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param set the set to decorate, must not be null
|
||||
* @param predicate the predicate to use for validation, must not be null
|
||||
* @return a decorated set
|
||||
* @throws IllegalArgumentException if set or predicate is null
|
||||
* @throws IllegalArgumentException if the set contains invalid elements
|
||||
*/
|
||||
public static <T> Set<T> predicatedSet(Set<T> set, Predicate<? super T> predicate) {
|
||||
return new PredicatedSet<T>(set, predicate);
|
||||
public static <E> PredicatedSet<E> predicatedSet(Set<E> set, Predicate<? super E> predicate) {
|
||||
return new PredicatedSet<E>(set, predicate);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
|
|
@ -51,14 +51,15 @@ public class PredicatedSortedSet<E> extends PredicatedSet<E> implements SortedSe
|
|||
* If there are any elements already in the set being decorated, they
|
||||
* are validated.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param set the set to decorate, must not be null
|
||||
* @param predicate the predicate to use for validation, must not be null
|
||||
* @return a new predicated sorted set.
|
||||
* @throws IllegalArgumentException if set or predicate is null
|
||||
* @throws IllegalArgumentException if the set contains invalid elements
|
||||
*/
|
||||
public static <T> SortedSet<T> predicatedSortedSet(SortedSet<T> set, Predicate<? super T> predicate) {
|
||||
return new PredicatedSortedSet<T>(set, predicate);
|
||||
public static <E> PredicatedSortedSet<E> predicatedSortedSet(SortedSet<E> set, Predicate<? super E> predicate) {
|
||||
return new PredicatedSortedSet<E>(set, predicate);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
|
|
@ -41,11 +41,13 @@ public class SynchronizedSet<E> extends SynchronizedCollection<E> implements Set
|
|||
/**
|
||||
* Factory method to create a synchronized set.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param set the set to decorate, must not be null
|
||||
* @return a new synchronized set
|
||||
* @throws IllegalArgumentException if set is null
|
||||
*/
|
||||
public static <T> Set<T> synchronizedSet(Set<T> set) {
|
||||
return new SynchronizedSet<T>(set);
|
||||
public static <E> SynchronizedSet<E> synchronizedSet(Set<E> set) {
|
||||
return new SynchronizedSet<E>(set);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
|
|
@ -42,11 +42,13 @@ public class SynchronizedSortedSet<E> extends SynchronizedCollection<E> implemen
|
|||
/**
|
||||
* Factory method to create a synchronized set.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param set the set to decorate, must not be null
|
||||
* @return a new synchronized sorted set
|
||||
* @throws IllegalArgumentException if set is null
|
||||
*/
|
||||
public static <T> SortedSet<T> synchronizedSortedSet(SortedSet<T> set) {
|
||||
return new SynchronizedSortedSet<T>(set);
|
||||
public static <E> SynchronizedSortedSet<E> synchronizedSortedSet(SortedSet<E> set) {
|
||||
return new SynchronizedSortedSet<E>(set);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
|
|
@ -48,11 +48,13 @@ public class TransformedSet<E> extends TransformedCollection<E> implements Set<E
|
|||
* are NOT transformed.
|
||||
* Contrast this with {@link #transformedSet(Set, Transformer)}.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param set the set to decorate, must not be null
|
||||
* @param transformer the transformer to use for conversion, must not be null
|
||||
* @return a new transformed set
|
||||
* @throws IllegalArgumentException if set or transformer is null
|
||||
*/
|
||||
public static <E> Set<E> transformingSet(Set<E> set, Transformer<? super E, ? extends E> transformer) {
|
||||
public static <E> TransformedSet<E> transformingSet(Set<E> set, Transformer<? super E, ? extends E> transformer) {
|
||||
return new TransformedSet<E>(set, transformer);
|
||||
}
|
||||
|
||||
|
@ -64,9 +66,10 @@ public class TransformedSet<E> extends TransformedCollection<E> implements Set<E
|
|||
* will be transformed by this method.
|
||||
* Contrast this with {@link #transformingSet(Set, Transformer)}.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param set the set to decorate, must not be null
|
||||
* @param transformer the transformer to use for conversion, must not be null
|
||||
* @return a new transformed Set
|
||||
* @return a new transformed set
|
||||
* @throws IllegalArgumentException if set or transformer is null
|
||||
* @since Commons Collections 3.3
|
||||
*/
|
||||
|
|
|
@ -48,11 +48,14 @@ public class TransformedSortedSet<E> extends TransformedSet<E> implements Sorted
|
|||
* are NOT transformed.
|
||||
* Contrast this with {@link #transformedSortedSet(SortedSet, Transformer)}.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param set the set to decorate, must not be null
|
||||
* @param transformer the transformer to use for conversion, must not be null
|
||||
* @return a new transformed {@link SortedSet}
|
||||
* @throws IllegalArgumentException if set or transformer is null
|
||||
*/
|
||||
public static <E> SortedSet<E> transformingSortedSet(SortedSet<E> set, Transformer<? super E, ? extends E> transformer) {
|
||||
public static <E> TransformedSortedSet<E> transformingSortedSet(SortedSet<E> set,
|
||||
Transformer<? super E, ? extends E> transformer) {
|
||||
return new TransformedSortedSet<E>(set, transformer);
|
||||
}
|
||||
|
||||
|
@ -64,13 +67,15 @@ public class TransformedSortedSet<E> extends TransformedSet<E> implements Sorted
|
|||
* will be transformed by this method.
|
||||
* Contrast this with {@link #transformingSortedSet(SortedSet, Transformer)}.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param set the set to decorate, must not be null
|
||||
* @param transformer the transformer to use for conversion, must not be null
|
||||
* @return a new transformed SortedSet
|
||||
* @return a new transformed {@link SortedSet}
|
||||
* @throws IllegalArgumentException if set or transformer is null
|
||||
* @since Commons Collections 3.3
|
||||
*/
|
||||
public static <E> SortedSet<E> transformedSortedSet(SortedSet<E> set, Transformer<? super E, ? extends E> transformer) {
|
||||
public static <E> TransformedSortedSet<E> transformedSortedSet(SortedSet<E> set,
|
||||
Transformer<? super E, ? extends E> transformer) {
|
||||
TransformedSortedSet<E> decorated = new TransformedSortedSet<E>(set, transformer);
|
||||
if (transformer != null && set != null && set.size() > 0) {
|
||||
@SuppressWarnings("unchecked") // set is type E
|
||||
|
|
|
@ -45,7 +45,9 @@ public final class UnmodifiableSet<E>
|
|||
/**
|
||||
* Factory method to create an unmodifiable set.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param set the set to decorate, must not be null
|
||||
* @return a new unmodifiable set
|
||||
* @throws IllegalArgumentException if set is null
|
||||
*/
|
||||
public static <E> Set<E> unmodifiableSet(Set<E> set) {
|
||||
|
|
|
@ -49,14 +49,16 @@ public final class UnmodifiableSortedSet<E>
|
|||
/**
|
||||
* Factory method to create an unmodifiable set.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param set the set to decorate, must not be null
|
||||
* @return a new unmodifiable {@link SortedSet}
|
||||
* @throws IllegalArgumentException if set is null
|
||||
*/
|
||||
public static <T> SortedSet<T> unmodifiableSortedSet(SortedSet<T> set) {
|
||||
public static <E> SortedSet<E> unmodifiableSortedSet(SortedSet<E> set) {
|
||||
if (set instanceof Unmodifiable) {
|
||||
return set;
|
||||
}
|
||||
return new UnmodifiableSortedSet<T>(set);
|
||||
return new UnmodifiableSortedSet<E>(set);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue