Logo

Programming-Idioms

History of Idiom 7 > diff from v82 to v83

Edit summary for version 83 by JEFC:
[Java] Put it as list instead of array

Version 82

2020-04-24, 04:59:58

Version 83

2020-04-24, 05:00:58

Idiom #7 Iterate over list indexes and values

Print each index i with its value x from an array-like collection items

Idiom #7 Iterate over list indexes and values

Print each index i with its value x from an array-like collection items

Extra Keywords
traverse traversal
Extra Keywords
traverse traversal
Code
for (int x; x < arr.size(); x++) {
	System.out.println("index " + x + " value " + arr[x]);
}
Code
for (int x; x < list.size(); x++) {
	System.out.println("index " + x + " value " + list.get(x));
}