Lines Matching refs:map

45         TreeMap<String, String> map = new TreeMap<String, String>();
46 map.put("A", "a");
47 map.put("B", "b");
48 map.put("C", "c");
50 Iterator<Entry<String, String>> iterator = map.entrySet().iterator();
54 assertEquals("x", map.get("A"));
60 assertEquals("y", map.get("B"));
62 assertEquals("z", map.get("C"));
66 * Test that the entrySet() method of a sub map produces correctly mutable
67 * entries that propagate changes to the original map.
70 TreeMap<String, String> map = new TreeMap<String, String>();
71 map.put("A", "a");
72 map.put("B", "b");
73 map.put("C", "c");
74 map.put("D", "d");
75 NavigableMap<String, String> subMap = map.subMap("A", true, "C", true);
82 assertEquals("x", map.get("A"));
89 assertEquals("y", map.get("B"));
92 assertEquals("z", map.get("C"));
99 TreeMap<String, String> map = new TreeMap<String, String>();
100 map.put("A", "a");
101 map.put("B", "b");
102 map.put("C", "c");
104 assertAllEntryMethodsReturnImmutableEntries(map);
108 * Test that an Entry given by any method except entrySet() of a sub map is immutable.
111 TreeMap<String, String> map = new TreeMap<String, String>();
112 map.put("A", "a");
113 map.put("B", "b");
114 map.put("C", "c");
115 map.put("D", "d");
117 assertAllEntryMethodsReturnImmutableEntries(map.subMap("A", true, "C", true));
122 * immutable one. Assumes that the map contains at least entries with keys "A", "B" and "C".
124 private void assertAllEntryMethodsReturnImmutableEntries(NavigableMap<String, String> map) {
125 assertImmutable(map.ceilingEntry("B"));
126 assertImmutable(map.firstEntry());
127 assertImmutable(map.floorEntry("D"));
128 assertImmutable(map.higherEntry("A"));
129 assertImmutable(map.lastEntry());
130 assertImmutable(map.lowerEntry("C"));
131 assertImmutable(map.pollFirstEntry());
132 assertImmutable(map.pollLastEntry());
146 Map<String, String> map = new TreeMap<String, String>();
147 map.put("A", "a");
148 map.put("B", "b");
149 map.put("C", "c");
150 Iterator<Entry<String,String>> iterator = map.entrySet().iterator();
154 map.put("D", "d");
163 Map<String, String> map = new TreeMap<String, String>();
164 map.put("A", "a");
165 map.put("B", "b");
166 map.put("C", "c");
167 Iterator<Entry<String,String>> iterator = map.entrySet().iterator();
180 Map<String,String> map = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
181 map.put("ABC", "a");
182 assertTrue(map.entrySet().contains(new SimpleEntry<String, String>("abc", "a")));
183 assertTrue(map.entrySet().remove(new SimpleEntry<String, String>("abc", "a")));
184 assertEquals(0, map.size());
202 TreeMap<String,String> map = new TreeMap<String, String>();
204 map.put(null, "b");
210 map.descendingMap().put(null, "b");
216 map.subMap("a", "z").put(null, "b");
250 Map<Object, Object> map = new TreeMap<Object, Object>();
251 map.put("A", "a");
253 map.get(5);
258 map.containsKey(5);
263 map.remove(5);
270 Map<Object, Object> map = new TreeMap<Object, Object>().subMap("a", "z");
272 map.get(5);
277 map.containsKey(5);
282 map.remove(5);
289 TreeMap<String, String> map = new TreeMap<String, String>() {
295 map.put("A", "a");
296 map.put("B", "b");
299 TreeMap<String, String> clone = (TreeMap<String, String>) map.clone();
300 assertEquals(map.getClass(), clone.getClass());
301 assertEquals("x:{A=a, B=b}", map.toString());
308 TreeMap<String, String> map = new TreeMap<String, String>();
309 new SerializationTester<TreeMap<String, String>>(map, s).test();
318 TreeMap<String, String> map = new TreeMap<String, String>(
320 map.put("a", "a");
321 map.put("b", "b");
322 new SerializationTester<NavigableMap<String, String>>(map, s) {
344 TreeMap<String, String> map = new TreeMap<String, String>(
346 map.put("a", "a");
347 map.put("b", "b");
348 map.put("c", "c");
349 map.put("d", "d");
350 SortedMap<String, String> subMap = map.subMap("a", "c");
377 TreeMap<String, String> map = new TreeMap<String, String>(
379 map.put("a", "a");
380 map.put("b", "b");
381 map.put("c", "c");
382 map.put("d", "d");
383 SortedMap<String, String> subMap = map.subMap("a", false, "c", true);
412 TreeMap<String, String> map = new TreeMap<String, String>(
414 map.put("a", "a");
415 map.put("b", "b");
416 NavigableMap<String, String> descendingMap = map.descendingMap();
430 TreeMap<String, String> map = new TreeMap<String, String>(
432 map.put("a", "a");
433 map.put("b", "b");
434 new SerializationTester<TreeMap<String, String>>(map, s) {
456 TreeMap<String, String> map = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
457 map.put("a", "a");
458 map.put("b", "b");
459 map.put("c", "c");
460 map.put("d", "d");
461 SortedMap<String, String> subMap = map.subMap("a", "c");
485 * Taking an exclusive-end submap of a parent map with an exclusive
492 // documentation says that it throws IAE "if this map itself has a
514 * Taking a exclusive-end submap of an inclusive-end parent map is not
517 * contained in the exclusive range of the parent map.
527 * Taking an inclusive-end submap of an inclusive-end parent map
530 * contained in the inclusive range of the parent map.
540 * Taking an exclusive-end submap of an inclusive-end parent map
543 * contained in the inclusive range of the parent map.
574 * exclusive) bound 0 is allowed on a (head or tail) map with (inclusive or
594 * Constructs a submap of the specified map, constrained by the given bound.
750 TreeMap<String, String> map = new TreeMap<>();
751 map.put("one", "1");
752 map.put("two", "2");
753 map.put("three", "3");
756 map.replaceAll((k, v) -> k + v);
757 assertEquals("one1", map.get("one"));
758 assertEquals("two2", map.get("two"));
759 assertEquals("three3", map.get("three"));
762 map.replaceAll(null);
767 map.replaceAll((k, v) -> {
768 map.put("foo", v);