Be more flexible: follow the "PECS" rule for our Function.

This commit is contained in:
Ray Greenwell
2010-02-05 02:33:57 +00:00
parent 4fca0623dd
commit 9661056e10
2 changed files with 2 additions and 2 deletions
@@ -34,7 +34,7 @@ public class XArrayList<T> extends ArrayList<T>
implements XList<T>
{
// from interface XList<T>
public <R> Collection<R> map (Function<T, R> mapper)
public <R> Collection<R> map (Function<? super T, ? extends R> mapper)
{
return Lists.transform(this, mapper);
}
+1 -1
View File
@@ -38,5 +38,5 @@ public interface XList<T> extends List<T>
* Collection} to remind the caller that it is not an {@link ArrayList} but rather a lazy list
* that will call the mapping function on the fly each time an element is read. Caveat coder.
*/
public <R> Collection<R> map (Function<T, R> mapper);
public <R> Collection<R> map (Function<? super T, ? extends R> mapper);
}