Author: bayard Date: Tue Sep 15 05:56:45 2009 New Revision: 815102 URL: http://svn.apache.org/viewvc?rev=815102&view=rev Log: Merging from -r468106:814127 of collections_jdk5_branch - namely where this code was generified; mostly in r738956.
Also see the following revisions: ------------------------------------------------------------------------ r471202 | scolebourne | 2006-11-04 06:21:44 -0800 (Sat, 04 Nov 2006) | 1 line Remove getCollection() - use covariant decorated() ------------------------------------------------------------------------ Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/UnmodifiableSet.java Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/UnmodifiableSet.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/UnmodifiableSet.java?rev=815102&r1=815101&r2=815102&view=diff ============================================================================== --- commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/UnmodifiableSet.java (original) +++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/set/UnmodifiableSet.java Tue Sep 15 05:56:45 2009 @@ -35,8 +35,8 @@ * * @author Stephen Colebourne */ -public final class UnmodifiableSet - extends AbstractSerializableSetDecorator +public final class UnmodifiableSet<E> + extends AbstractSerializableSetDecorator<E> implements Unmodifiable { /** Serialization version */ @@ -48,11 +48,11 @@ * @param set the set to decorate, must not be null * @throws IllegalArgumentException if set is null */ - public static Set decorate(Set set) { + public static <E> Set<E> decorate(Set<E> set) { if (set instanceof Unmodifiable) { return set; } - return new UnmodifiableSet(set); + return new UnmodifiableSet<E>(set); } //----------------------------------------------------------------------- @@ -62,20 +62,20 @@ * @param set the set to decorate, must not be null * @throws IllegalArgumentException if set is null */ - private UnmodifiableSet(Set set) { + private UnmodifiableSet(Set<E> set) { super(set); } //----------------------------------------------------------------------- - public Iterator iterator() { - return UnmodifiableIterator.decorate(getCollection().iterator()); + public Iterator<E> iterator() { + return UnmodifiableIterator.<E>decorate(decorated().iterator()); } - public boolean add(Object object) { + public boolean add(E object) { throw new UnsupportedOperationException(); } - public boolean addAll(Collection coll) { + public boolean addAll(Collection<? extends E> coll) { throw new UnsupportedOperationException(); } @@ -87,11 +87,11 @@ throw new UnsupportedOperationException(); } - public boolean removeAll(Collection coll) { + public boolean removeAll(Collection<?> coll) { throw new UnsupportedOperationException(); } - public boolean retainAll(Collection coll) { + public boolean retainAll(Collection<?> coll) { throw new UnsupportedOperationException(); }