Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Map;
- import java.util.Map.Entry;
- import java.util.TreeMap;
- public class StringList {
- public static void main(String[] args) {
- String[] s = {"ABC", "DEF", "GHI"};
- Map<Integer, Map<Integer, String>> map =
- new TreeMap<Integer, Map<Integer, String>>();
- map.put(0, new TreeMap<Integer, String>());
- for (int i = 0; i < s.length; i++)
- map.get(0).put(i, s[i]);
- s[2] = "222";
- for (String e: s)
- System.out.println(e);
- for (Entry<Integer, Map<Integer, String>> e: map.entrySet())
- for (Entry<Integer, String> ee: e.getValue().entrySet())
- System.out.println(ee.getValue());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement