Daniel Berg

36%
Flag icon
// Mixing generics and varargs can violate type safety! static void dangerous(List<String>... stringLists) {     List<Integer> intList = List.of(42);     Object[] objects = stringLists;     objects[0] = intList;             // Heap pollution     String s = stringLists[0].get(0); // ClassCastException }
Daniel Berg
What a shit show!
Effective Java
Rate this book
Clear rating
Open Preview