Be more flexible: follow the "PECS" rule for our Function.
This commit is contained in:
@@ -34,7 +34,7 @@ public class XArrayList<T> extends ArrayList<T>
|
|||||||
implements XList<T>
|
implements XList<T>
|
||||||
{
|
{
|
||||||
// from interface 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);
|
return Lists.transform(this, mapper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
* 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.
|
* 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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user