3 ms·
They provide more type safety and not syntactic sugar. One cannot have complete type safety at runtime using type casts; if he thinks he can, he needs to take a
by mfukar 16y ago
They provide more type safety and not syntactic sugar. One cannot have complete type safety at runtime using type casts; if he thinks he can, he needs to take a simple programming course again.
If the OP wanted readability, he could use iterators. It's amazingly clear:
private void printCollection(Collection c) {
Iterator<String> i = c.iterator();
while(i.hasNext()) {
System.out.println("Item: "+i.next());
}
}