Joe Soltzberg

36%
Flag icon
The answer is that methods with varargs parameters of generic or parameterized types can be very useful in practice, so the language designers opted to live with this inconsistency. In fact, the Java libraries export several such methods, including Arrays.asList(T... a), Collections.addAll(Collection<? super T> c, T... elements), and EnumSet.of(E first, E... rest). Unlike the dangerous method shown earlier, these library methods are typesafe.
Joe Soltzberg
This is very similar to what I wanted to do....
Effective Java
Rate this book
Clear rating
Open Preview