TimurMahammadov / google-collections

Automatically exported from code.google.com/p/google-collections
Apache License 2.0
0 stars 0 forks source link

Methods returning unmodifiable collections should accept wild cards #79

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The JDK Collections class has the method
 static <T> Set<T> unmodifiableSet(Set<? extends T> s) 

The analogous Multisets method has the signature
 static <E> Multiset<E> unmodifiableMultiset(Multiset<E> multiset) 

Its input parameter should also allow a "? extends".
Iterables.unmodifiableIterable() and Iterators.unmodifiableIterator() could
be generalized similarly. I'm not sure about the
Multimaps.unmodifiable*Multimap method, but in any case we can't add
generic wild cards to Maps.unmodifiableBiMap.

Original issue reported on code.google.com by jared.l....@gmail.com on 12 Jun 2008 at 2:02

GoogleCodeExporter commented 9 years ago
For iterators and iterables, we won't make this change. Instead, we'll add 
methods
like the following:

public static <T> Iterator<T> adapt(final Iterator<? extends T> iterator)

Original comment by jared.l....@gmail.com on 25 Jun 2008 at 4:26

GoogleCodeExporter commented 9 years ago
The work has been done to add these wherever feasible, so that will be included 
in 1.0.

Original comment by kevin...@gmail.com on 17 Mar 2009 at 5:25