Hey.
There is a code:
Map<String, List<String>> HashMap = new HashMap<String, List<String>>(); List<String> string_list = new ArrayList<String>(); string_list.add("Whysss?"); string_list.add("a1_q"); string_list.add("a2_q"); HashMap.put("ONE", string_list); string_list.add("Whysss?_2"); string_list.add("a1_q_2"); string_list.add("a2_q_2"); HashMap.put("TWO", string_list); System.out.println(HashMap.get("ONE")); System.out.println(HashMap.get("TWO")); Результат: [Whysss?, a1_q, a2_q, Whysss?_2, a1_q_2, a2_q_2] [Whysss?, a1_q, a2_q, Whysss?_2, a1_q_2, a2_q_2]
The question is that both the "ONE" key and the "TWO" key return the same block, and I need the "ONE" to return [Whysss ?, a1_q, a2_q], a "TWO" [Whysss? _2, a1_q_2, a2_q_2].
Can not use HashMap? Is there any more convenient implementation of a multidimensional associative array in JAVA?