type equality constraint: reject type/wildcard pairs; subtyping constraint: become eq constraint for types

This commit is contained in:
Anna Kozlova
2014-01-31 21:41:19 +04:00
parent 948e76acf5
commit be84252e83
5 changed files with 87 additions and 41 deletions
@@ -0,0 +1,22 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public class Sample {
static List<String> getList(Function<Object, String> function, ArrayList<? super String> objects) {
return transform(objects, new ArrayList<String>(), function);
}
static <R, S, T extends Collection<S>> T transform(Iterable<? extends R> oldCollection,
T newCollection,
Function<R, S> function) {
return newCollection;
}
interface Function<X, Y> {
Y apply(X input);
}
}