/libcore/luni/src/test/java/libcore/java/util/ |
D | OldAndroidHashMapTest.java | 29 private void addItems(HashMap<String, Integer> map) { in addItems() argument 30 map.put("one", ONE); in addItems() 31 map.put("two", TWO); in addItems() 32 map.put("three", THREE); in addItems() 33 map.put("four", FOUR); in addItems() 35 assertEquals(4, map.size()); in addItems() 37 assertEquals(ONE, map.get("one")); in addItems() 38 assertEquals(TWO, map.get("two")); in addItems() 39 assertEquals(THREE, map.get("three")); in addItems() 40 assertEquals(FOUR, map.get("four")); in addItems() [all …]
|
D | WeakHashMapTest.java | 35 WeakHashMap<Data, String> map = new WeakHashMap<>(); in test_replaceAll() local 37 map.put(data[i], ""); in test_replaceAll() 39 map.replaceAll((k, v) -> k.value); in test_replaceAll() 42 assertEquals(data[i].value, map.get(data[i])); in test_replaceAll() 46 map.replaceAll(new java.util.function.BiFunction<Data, String, String>() { in test_replaceAll() 49 map.put(new Data(), ""); in test_replaceAll() 58 map.replaceAll(null); in test_replaceAll() 63 map.clear(); in test_replaceAll() 65 map.put(data[i], data[i].value); in test_replaceAll() 68 map.replaceAll((k, v) -> null); in test_replaceAll() [all …]
|
D | TreeMapTest.java | 45 TreeMap<String, String> map = new TreeMap<String, String>(); in testEntrySetSetValue() local 46 map.put("A", "a"); in testEntrySetSetValue() 47 map.put("B", "b"); in testEntrySetSetValue() 48 map.put("C", "c"); in testEntrySetSetValue() 50 Iterator<Entry<String, String>> iterator = map.entrySet().iterator(); in testEntrySetSetValue() 54 assertEquals("x", map.get("A")); in testEntrySetSetValue() 60 assertEquals("y", map.get("B")); in testEntrySetSetValue() 62 assertEquals("z", map.get("C")); in testEntrySetSetValue() 70 TreeMap<String, String> map = new TreeMap<String, String>(); in testSubMapEntrySetSetValue() local 71 map.put("A", "a"); in testSubMapEntrySetSetValue() [all …]
|
/libcore/ojluni/src/test/java/util/Map/ |
D | Defaults.java | 74 public void testGetOrDefaultNulls(String description, Map<IntegerEnum, String> map) { in testGetOrDefaultNulls() argument 75 assertTrue(map.containsKey(null), description + ": null key absent"); in testGetOrDefaultNulls() 76 assertNull(map.get(null), description + ": value not null"); in testGetOrDefaultNulls() 77 …assertSame(map.get(null), map.getOrDefault(null, EXTRA_VALUE), description + ": values should matc… in testGetOrDefaultNulls() 81 public void testGetOrDefault(String description, Map<IntegerEnum, String> map) { in testGetOrDefault() argument 82 assertTrue(map.containsKey(KEYS[1]), "expected key missing"); in testGetOrDefault() 83 assertSame(map.get(KEYS[1]), map.getOrDefault(KEYS[1], EXTRA_VALUE), "values should match"); in testGetOrDefault() 84 assertFalse(map.containsKey(EXTRA_KEY), "expected absent key"); in testGetOrDefault() 85 …assertSame(map.getOrDefault(EXTRA_KEY, EXTRA_VALUE), EXTRA_VALUE, "value not returned as default"); in testGetOrDefault() 86 assertNull(map.getOrDefault(EXTRA_KEY, null), "null not returned as default"); in testGetOrDefault() [all …]
|
D | InPlaceOpsCollisions.java | 50 Map<Object, Object> map = ms.get(); in testPutIfAbsent() local 51 Object[] keys = map.keySet().toArray(); in testPutIfAbsent() 53 removeOddKeys(map, keys); in testPutIfAbsent() 55 retVal = map.putIfAbsent(keys[i], val); in testPutIfAbsent() 60 assertEquals(keys[i], map.get(keys[i]), in testPutIfAbsent() 62 assertTrue(map.containsValue(keys[i]), in testPutIfAbsent() 67 assertEquals(val, map.get(keys[i]), in testPutIfAbsent() 69 assertFalse(map.containsValue(keys[i]), in testPutIfAbsent() 72 assertTrue(map.containsKey(keys[i]), in testPutIfAbsent() 75 assertEquals(map.size(), keys.length, in testPutIfAbsent() [all …]
|
D | Collisions.java | 50 Map<IntKey, IntKey> map = ms.get(); in testIntegerIteration() local 51 int mapSize = map.size(); in testIntegerIteration() 54 for (Map.Entry<IntKey, IntKey> each : map.entrySet()) { in testIntegerIteration() 62 for (IntKey each : map.keySet()) { in testIntegerIteration() 71 for (IntKey each : map.values()) { in testIntegerIteration() 75 assertEquals(map.size(), count, in testIntegerIteration() 76 String.format("Iteration: value count matches size m%d != c%d", map.size(), count)); in testIntegerIteration() 81 Map<String, String> map = ms.get(); in testStringIteration() local 82 int mapSize = map.size(); in testStringIteration() 85 for (Map.Entry<String, String> each : map.entrySet()) { in testStringIteration() [all …]
|
/libcore/jsr166-tests/src/test/java/jsr166/ |
D | ConcurrentSkipListSubMapTest.java | 38 ConcurrentSkipListMap map = new ConcurrentSkipListMap(); in map5() local 39 assertTrue(map.isEmpty()); in map5() 40 map.put(zero, "Z"); in map5() 41 map.put(one, "A"); in map5() 42 map.put(five, "E"); in map5() 43 map.put(three, "C"); in map5() 44 map.put(two, "B"); in map5() 45 map.put(four, "D"); in map5() 46 map.put(seven, "F"); in map5() 47 assertFalse(map.isEmpty()); in map5() [all …]
|
D | TreeSubMapTest.java | 37 TreeMap map = new TreeMap(); in map5() local 38 assertTrue(map.isEmpty()); in map5() 39 map.put(zero, "Z"); in map5() 40 map.put(one, "A"); in map5() 41 map.put(five, "E"); in map5() 42 map.put(three, "C"); in map5() 43 map.put(two, "B"); in map5() 44 map.put(four, "D"); in map5() 45 map.put(seven, "F"); in map5() 46 assertFalse(map.isEmpty()); in map5() [all …]
|
D | ConcurrentSkipListMapTest.java | 40 ConcurrentSkipListMap map = new ConcurrentSkipListMap(); in map5() local 41 assertTrue(map.isEmpty()); in map5() 42 map.put(one, "A"); in map5() 43 map.put(five, "E"); in map5() 44 map.put(three, "C"); in map5() 45 map.put(two, "B"); in map5() 46 map.put(four, "D"); in map5() 47 assertFalse(map.isEmpty()); in map5() 48 assertEquals(5, map.size()); in map5() 49 return map; in map5() [all …]
|
D | ConcurrentHashMapTest.java | 40 ConcurrentHashMap map = new ConcurrentHashMap<Integer, String>(5); in map5() local 41 assertTrue(map.isEmpty()); in map5() 42 map.put(one, "A"); in map5() 43 map.put(two, "B"); in map5() 44 map.put(three, "C"); in map5() 45 map.put(four, "D"); in map5() 46 map.put(five, "E"); in map5() 47 assertFalse(map.isEmpty()); in map5() 48 assertEquals(5, map.size()); in map5() 49 return map; in map5() [all …]
|
D | TreeMapTest.java | 39 TreeMap map = new TreeMap(); in map5() local 40 assertTrue(map.isEmpty()); in map5() 41 map.put(one, "A"); in map5() 42 map.put(five, "E"); in map5() 43 map.put(three, "C"); in map5() 44 map.put(two, "B"); in map5() 45 map.put(four, "D"); in map5() 46 assertFalse(map.isEmpty()); in map5() 47 assertEquals(5, map.size()); in map5() 48 return map; in map5() [all …]
|
/libcore/ojluni/src/test/java/util/concurrent/tck/ |
D | ConcurrentSkipListSubMapTest.java | 61 ConcurrentSkipListMap map = new ConcurrentSkipListMap(); in map5() local 62 assertTrue(map.isEmpty()); in map5() 63 map.put(zero, "Z"); in map5() 64 map.put(one, "A"); in map5() 65 map.put(five, "E"); in map5() 66 map.put(three, "C"); in map5() 67 map.put(two, "B"); in map5() 68 map.put(four, "D"); in map5() 69 map.put(seven, "F"); in map5() 70 assertFalse(map.isEmpty()); in map5() [all …]
|
D | TreeSubMapTest.java | 60 TreeMap map = new TreeMap(); in map5() local 61 assertTrue(map.isEmpty()); in map5() 62 map.put(zero, "Z"); in map5() 63 map.put(one, "A"); in map5() 64 map.put(five, "E"); in map5() 65 map.put(three, "C"); in map5() 66 map.put(two, "B"); in map5() 67 map.put(four, "D"); in map5() 68 map.put(seven, "F"); in map5() 69 assertFalse(map.isEmpty()); in map5() [all …]
|
D | ConcurrentSkipListMapTest.java | 63 ConcurrentSkipListMap map = new ConcurrentSkipListMap(); in map5() local 64 assertTrue(map.isEmpty()); in map5() 65 map.put(one, "A"); in map5() 66 map.put(five, "E"); in map5() 67 map.put(three, "C"); in map5() 68 map.put(two, "B"); in map5() 69 map.put(four, "D"); in map5() 70 assertFalse(map.isEmpty()); in map5() 71 assertEquals(5, map.size()); in map5() 72 return map; in map5() [all …]
|
D | ConcurrentHashMapTest.java | 65 ConcurrentHashMap<Integer, String> map = new ConcurrentHashMap<>(5); in map5() local 66 assertTrue(map.isEmpty()); in map5() 67 map.put(one, "A"); in map5() 68 map.put(two, "B"); in map5() 69 map.put(three, "C"); in map5() 70 map.put(four, "D"); in map5() 71 map.put(five, "E"); in map5() 72 assertFalse(map.isEmpty()); in map5() 73 assertEquals(5, map.size()); in map5() 74 return map; in map5() [all …]
|
D | TreeMapTest.java | 62 TreeMap map = new TreeMap(); in map5() local 63 assertTrue(map.isEmpty()); in map5() 64 map.put(one, "A"); in map5() 65 map.put(five, "E"); in map5() 66 map.put(three, "C"); in map5() 67 map.put(two, "B"); in map5() 68 map.put(four, "D"); in map5() 69 assertFalse(map.isEmpty()); in map5() 70 assertEquals(5, map.size()); in map5() 71 return map; in map5() [all …]
|
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/ |
D | SortedMapTestBase.java | 43 SortedMap<Integer, Integer> map; field in SortedMapTestBase 56 map.clear(); in testClear() 57 assertTrue(map.isEmpty()); in testClear() 63 assertEquals(ref.containsKey(key), map.containsKey(key)); in testContainsKey() 71 assertEquals(ref.containsValue(value), map.containsValue(value)); in testContainsValue() 78 Set<Map.Entry<Integer, Integer>> mapSet = map.entrySet(); in testEntrySet() 85 assertEquals(ref.entrySet(), map.entrySet()); in testEntrySet() 92 assertEquals(ref.get(key), map.get(key)); in testGet() 98 assertEquals(ref.keySet(), map.keySet()); in testKeySet() 100 Iterator<Integer> j = map.keySet().iterator(); in testKeySet() [all …]
|
D | IdentityHashMapTest.java | 145 IdentityHashMap map = new IdentityHashMap(); in test_clone() local 146 map.put("key", "value"); in test_clone() 148 Set keys = map.keySet(); in test_clone() 149 Collection values = map.values(); in test_clone() 154 AbstractMap map2 = (AbstractMap) map.clone(); in test_clone() 262 Map map = new IdentityHashMap(101); in test_keySet() local 263 map.put(new Integer(1), "1"); in test_keySet() 264 map.put(new Integer(102), "102"); in test_keySet() 265 map.put(new Integer(203), "203"); in test_keySet() 266 Iterator it = map.keySet().iterator(); in test_keySet() [all …]
|
/libcore/ojluni/src/test/java/util/WeakHashMap/ |
D | GCDuringIteration.java | 97 <K,V> void put(Map<K,V> map, K k, V v) { in put() argument 98 check(! map.containsKey(k)); in put() 99 equal(map.get(k), null); in put() 100 equal(map.put(k, v), null); in put() 101 equal(map.get(k), v); in put() 102 check(map.containsKey(k)); in put() 103 equal(map.put(k, v), v); in put() 104 equal(map.get(k), v); in put() 105 check(map.containsKey(k)); in put() 106 check(! map.isEmpty()); in put() [all …]
|
/libcore/ojluni/src/test/java/util/SequencedCollection/ |
D | BasicMap.java | 64 M load(M map, List<Map.Entry<String, Integer>> mappings) { in load() argument 66 map.put(e.getKey(), e.getValue()); in load() 67 return map; in load() 70 static NavigableMap<String, Integer> cknav(NavigableMap<String, Integer> map) { in cknav() argument 71 return Collections.checkedNavigableMap(map, String.class, Integer.class); in cknav() 74 static SortedMap<String, Integer> cksorted(SortedMap<String, Integer> map) { in cksorted() argument 75 return Collections.checkedSortedMap(map, String.class, Integer.class); in cksorted() 78 static SequencedMap<String, Integer> umap(SequencedMap<String, Integer> map) { in umap() argument 79 return Collections.unmodifiableSequencedMap(map); in umap() 82 static SortedMap<String, Integer> usorted(SortedMap<String, Integer> map) { in usorted() argument [all …]
|
D | SimpleSortedMap.java | 33 final SortedMap<K,V> map; field in SimpleSortedMap 36 map = new TreeMap<>(); in SimpleSortedMap() 40 map = new TreeMap<>(comparator); in SimpleSortedMap() 44 map = new TreeMap<>(m); in SimpleSortedMap() 50 return map.equals(o); in equals() 54 return map.hashCode(); in hashCode() 58 return map.toString(); in toString() 64 map.clear(); in clear() 68 return map.containsKey(key); in containsKey() 72 return map.containsValue(value); in containsValue() [all …]
|
/libcore/support/src/test/java/tests/support/ |
D | Support_MapTest2.java | 25 Map<String, String> map; field in Support_MapTest2 29 map = m; in Support_MapTest2() 30 if (!map.isEmpty()) { in Support_MapTest2() 38 map.put("one", "1"); in runTest() 39 assertEquals("size should be one", 1, map.size()); in runTest() 40 map.clear(); in runTest() 41 assertEquals("size should be zero", 0, map.size()); in runTest() 42 assertTrue("Should not have entries", !map.entrySet().iterator() in runTest() 44 assertTrue("Should not have keys", !map.keySet().iterator() in runTest() 46 assertTrue("Should not have values", !map.values().iterator() in runTest() [all …]
|
/libcore/benchmarks/src/benchmarks/ |
D | HashedCollectionsBenchmark.java | 29 HashMap<String, String> map = new HashMap<String, String>(); in timeHashMapGet() local 30 map.put("hello", "world"); in timeHashMapGet() 32 map.get("hello"); in timeHashMapGet() 36 HashMap<String, String> map = new HashMap<String, String>(); in timeHashMapGet_Synchronized() local 37 synchronized (map) { in timeHashMapGet_Synchronized() 38 map.put("hello", "world"); in timeHashMapGet_Synchronized() 41 synchronized (map) { in timeHashMapGet_Synchronized() 42 map.get("hello"); in timeHashMapGet_Synchronized() 47 Hashtable<String, String> map = new Hashtable<String, String>(); in timeHashtableGet() local 48 map.put("hello", "world"); in timeHashtableGet() [all …]
|
/libcore/ojluni/src/main/java/java/beans/ |
D | ChangeListenerMap.java | 48 private Map<String, L[]> map; field in ChangeListenerMap 78 if (this.map == null) { in add() 79 this.map = new HashMap<>(); in add() 81 L[] array = this.map.get(name); in add() 91 this.map.put(name, clone); in add() 103 if (this.map != null) { in remove() 104 L[] array = this.map.get(name); in remove() 113 this.map.put(name, clone); in remove() 116 this.map.remove(name); in remove() 117 if (this.map.isEmpty()) { in remove() [all …]
|
/libcore/ojluni/src/main/java/java/util/ |
D | HashSet.java | 97 transient HashMap<E,Object> map; field in HashSet 107 map = new HashMap<>(); in HashSet() 120 map = HashMap.newHashMap(Math.max(c.size(), 12)); in HashSet() 138 map = new HashMap<>(initialCapacity, loadFactor); in HashSet() 154 map = new HashMap<>(initialCapacity); in HashSet() 171 map = new LinkedHashMap<>(initialCapacity, loadFactor); in HashSet() 182 return map.keySet().iterator(); in iterator() 191 return map.size(); in size() 200 return map.isEmpty(); in isEmpty() 213 return map.containsKey(o); in contains() [all …]
|