public static <E> Set<E> union(Set<? extends E> s1, Set<? extends E> s2) { /* ... */ }
Set<Integer> integers = ... ;
Set<Double> doubles = ... ;
Set<Number> numbers = Union.union(integers, doubles); // does not compile
How can you make the program compile?
Set<Number> numbers = Union.<Number>union(integers, doubles);
public static <E> Set<E> union(Set<? extends E> s1, Set<? extends E> s2) { /* ... */ }
Set<Integer> integers = ... ;
Set<Double> doubles = ... ;
Set<Number> numbers = Union.union(integers, doubles); // does not compile
How can you make the program compile?
public static <E> Set<E> union(Set<? extends E> s1, Set<? extends E> s2) { /* ... */ }
Set<Integer> integers = ... ;
Set<Double> doubles = ... ;
Set<Number> numbers = Union.union(integers, doubles); // does not compile
How can you make the program compile?
Set<Number> numbers = Union.<Number>union(integers, doubles);
status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|
repetition number in this series | 0 | memorised on | scheduled repetition | ||||
scheduled repetition interval | last repetition or drill |