3 ms·
If you look close enough you can almost figure out what it's doing between all the line noise.
by fleitz 16y ago
If you look close enough you can almost figure out what it's doing between all the line noise.
- nl 16y ago// create an array list with 4 integer elements ArrayList<Integer> list = com.google.common.collect.Lists.newArrayList(1,2,3,4); // get an Iterator from the list, and use it to iterate though the list for (Iterator<Integer> it = list.iterator(); it.hasNext(); ) { // check if this element is even. // If we want the odd numbers, change to != 0 if (it.next() % 2 == 0) { // remove it if it is even it.remove(); } } // print the list System.out.println(list);
- TeHCrAzY 16y agoNot sure if you were being a smart ass, but it would be much more readable without any of the comments, and simply with the new lines.
- nl 16y agoI'm being a smartass. Kinda.. The commenter said they could almost figure out what it's doing. It's not clear from that that comment if it is just the formatting that was the problem (which I agree, isn't very readable).