mirror of
https://github.com/cincheo/jsweet.git
synced 2025-12-14 23:09:22 +00:00
Test for iteration variable bug
This commit is contained in:
parent
fe01063690
commit
1e274cb9cb
@ -1,6 +1,8 @@
|
||||
package source.nativestructures;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class Iterators {
|
||||
|
||||
@ -20,6 +22,23 @@ public class Iterators {
|
||||
assert i == j++;
|
||||
}
|
||||
assert j == 20;
|
||||
|
||||
// -----
|
||||
|
||||
Map<Integer, String> sortedMap = new TreeMap<Integer, String>();
|
||||
sortedMap.put(1, "A");
|
||||
sortedMap.put(2, "B");
|
||||
sortedMap.put(3, "C");
|
||||
final String [] strings = sortedMap.values().toArray(new String [sortedMap.size()]);
|
||||
final int [] stringIndices = new int [strings.length];
|
||||
final String [] strings2 = new String[strings.length];
|
||||
int i = 0;
|
||||
for (int index : sortedMap.keySet()) {
|
||||
stringIndices [i] = index;
|
||||
strings2 [i] = strings[i];
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user