I like to use a for loop with an iterator principle like
for(String s : collectionWithStrings) System.out.println(s + ", ");
Question: How to determine if the current item is the last?
With a native index like int = 0; i < collection.size(); i++ int = 0; i < collection.size(); i++ int = 0; i < collection.size(); i++ , this is possible with i == collection.size() - 1 , but not nice. Is it also possible to define the last element with an iterator for the example above?
John threepwood
source share