/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 | 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 …]
|
D | CollectionsTest.java | 293 NavigableMap<String, Integer> map = checkedNavigableMap( in test_checkedNavigableMap_replaceAll() local 296 map.replaceAll((k, v) -> 5 * v); in test_checkedNavigableMap_replaceAll() 299 map); in test_checkedNavigableMap_replaceAll() 303 NavigableMap<Integer, Double> map = in test_checkedNavigableMap_putIfAbsent() local 305 MapDefaultMethodTester.test_putIfAbsent(map, in test_checkedNavigableMap_putIfAbsent() 310 NavigableMap<Integer, Double> map = in test_checkedNavigableMap_remove() local 312 MapDefaultMethodTester.test_remove(map, in test_checkedNavigableMap_remove() 317 NavigableMap<Integer, Double> map = in test_checkedNavigableMap_replace$K$V() local 319 MapDefaultMethodTester.test_replace$K$V$V(map, in test_checkedNavigableMap_replace$K$V() 324 NavigableMap<Integer, Double> map = in test_checkedNavigableMap_replace$K$V$V() local [all …]
|
D | WeakHashMapTest.java | 30 WeakHashMap<Data, String> map = new WeakHashMap<>(); in test_replaceAll() local 32 map.put(data[i], ""); in test_replaceAll() 34 map.replaceAll((k, v) -> k.value); in test_replaceAll() 37 assertEquals(data[i].value, map.get(data[i])); in test_replaceAll() 41 map.replaceAll(new java.util.function.BiFunction<Data, String, String>() { in test_replaceAll() 44 map.put(new Data(), ""); in test_replaceAll() 53 map.replaceAll(null); in test_replaceAll() 58 map.clear(); in test_replaceAll() 60 map.put(data[i], data[i].value); in test_replaceAll() 63 map.replaceAll((k, v) -> null); in test_replaceAll() [all …]
|
D | OldLinkedHashMapTest.java | 29 LinkedHashMap map = new LinkedHashMap<String, String>(10, 0.75f, true); in testLinkedHashMap() local 31 map.put("key1", "value1"); in testLinkedHashMap() 32 map.put("key2", "value2"); in testLinkedHashMap() 33 map.put("key3", "value3"); in testLinkedHashMap() 35 Iterator iterator = map.keySet().iterator(); in testLinkedHashMap() 37 map.get(id); in testLinkedHashMap() 49 LinkedHashMap mapClone = (LinkedHashMap) map.clone(); in testLinkedHashMap() 51 iterator = map.keySet().iterator(); in testLinkedHashMap()
|
/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/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 …]
|
D | AbstractMapTest.java | 142 AbstractMap map = new HashMap(); in test_clear() local 143 map.put(1, 1); in test_clear() 144 map.clear(); in test_clear() 145 assertTrue(map.isEmpty()); in test_clear() 175 AbstractMap map = new AMT(); in test_containsKey() local 177 assertFalse(map.containsKey("k")); in test_containsKey() 178 assertFalse(map.containsKey(null)); in test_containsKey() 180 map.put("k", "v"); in test_containsKey() 181 map.put("key", null); in test_containsKey() 182 map.put(null, "value"); in test_containsKey() [all …]
|
D | HashMapTest.java | 183 HashMap<Integer, String> map = new HashMap<Integer, String>(); in test_clear() local 185 map.put(i, "foobar"); in test_clear() 187 map.clear(); in test_clear() 190 assertNull("Failed to clear integer map values", map.get(i)); in test_clear() 205 HashMap map = new HashMap(); in test_clone() local 206 map.put("key", "value"); in test_clone() 208 Set keys = map.keySet(); in test_clone() 209 Collection values = map.values(); in test_clone() 214 AbstractMap map2 = (AbstractMap) map.clone(); in test_clone() 332 HashMap map = new HashMap(); in test_getLjava_lang_Object() local [all …]
|
D | WeakHashMapTest.java | 124 WeakHashMap map = new WeakHashMap(mockMap); in test_ConstructorLjava_util_Map() local 125 assertEquals("Size should be 0", 0, map.size()); in test_ConstructorLjava_util_Map() 237 WeakHashMap map = new WeakHashMap(); in test_putLjava_lang_ObjectLjava_lang_Object() local 238 map.put(null, "value"); // add null key in test_putLjava_lang_ObjectLjava_lang_Object() 242 map.remove("nothing"); // Cause objects in queue to be removed in test_putLjava_lang_ObjectLjava_lang_Object() 243 assertEquals("null key was removed", 1, map.size()); in test_putLjava_lang_ObjectLjava_lang_Object() 251 WeakHashMap map = new WeakHashMap(); in test_putAllLjava_util_Map() local 252 map.putAll(mockMap); in test_putAllLjava_util_Map() 253 assertEquals("Size should be 0", 0, map.size()); in test_putAllLjava_util_Map() 256 map.putAll(null); in test_putAllLjava_util_Map() [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 | 95 private transient HashMap<E,Object> map; field in HashSet 105 map = new HashMap<>(); in HashSet() 118 map = new HashMap<>(Math.max((int) (c.size()/.75f) + 1, 16)); in HashSet() 132 map = new HashMap<>(initialCapacity, loadFactor); in HashSet() 144 map = new HashMap<>(initialCapacity); in HashSet() 161 map = new LinkedHashMap<>(initialCapacity, loadFactor); in HashSet() 172 return map.keySet().iterator(); in iterator() 181 return map.size(); in size() 190 return map.isEmpty(); in isEmpty() 203 return map.containsKey(o); in contains() [all …]
|
/libcore/ojluni/src/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ |
D | MapOpTest.java | 53 assertCountSum(countTo(0).stream().map(mId), 0, 0); in testMap() 54 assertCountSum(countTo(10).stream().map(mId), 10, 55); in testMap() 55 assertCountSum(countTo(10).stream().map(mZero), 10, 0); in testMap() 56 assertCountSum(countTo(0).stream().map(mDoubler), 0, 0); in testMap() 57 assertCountSum(countTo(10).stream().map(mDoubler), 10, 110); in testMap() 58 assertCountSum(countTo(10).stream().map(mDoubler).map(mDoubler), 10, 220); in testMap() 60 exerciseOps(countTo(0), s -> s.map(LambdaTestHelpers.identity()), countTo(0)); in testMap() 61 exerciseOps(countTo(1000), s -> s.map(LambdaTestHelpers.identity()), countTo(1000)); in testMap() 65 exerciseOps(countTo(1000), s -> s.map(e -> (Integer) (1000 + e)), range(1001, 2000)); in testMap() 87 … exerciseOpsInt(data, s -> s.map(mId), s -> s.map(e -> e), s -> s.map(e -> e), s -> s.map(e -> e)); in testOps() [all …]
|
/libcore/ojluni/src/main/java/java/time/ |
D | ZoneId.java | 220 Map<String, String> map = new HashMap<>(64); 221 map.put("ACT", "Australia/Darwin"); 222 map.put("AET", "Australia/Sydney"); 223 map.put("AGT", "America/Argentina/Buenos_Aires"); 224 map.put("ART", "Africa/Cairo"); 225 map.put("AST", "America/Anchorage"); 226 map.put("BET", "America/Sao_Paulo"); 227 map.put("BST", "Asia/Dhaka"); 228 map.put("CAT", "Africa/Harare"); 229 map.put("CNT", "America/St_Johns"); [all …]
|
/libcore/ojluni/src/main/java/sun/nio/ch/ |
D | SocketOptionRegistry.java | 59 Map<RegistryKey,OptionKey> map = in options() local 61 … map.put(new RegistryKey(StandardSocketOptions.SO_BROADCAST, Net.UNSPEC), new OptionKey(1, 6)); in options() 62 … map.put(new RegistryKey(StandardSocketOptions.SO_KEEPALIVE, Net.UNSPEC), new OptionKey(1, 9)); in options() 63 … map.put(new RegistryKey(StandardSocketOptions.SO_LINGER, Net.UNSPEC), new OptionKey(1, 13)); in options() 64 … map.put(new RegistryKey(StandardSocketOptions.SO_SNDBUF, Net.UNSPEC), new OptionKey(1, 7)); in options() 65 … map.put(new RegistryKey(StandardSocketOptions.SO_RCVBUF, Net.UNSPEC), new OptionKey(1, 8)); in options() 66 … map.put(new RegistryKey(StandardSocketOptions.SO_REUSEADDR, Net.UNSPEC), new OptionKey(1, 2)); in options() 67 … map.put(new RegistryKey(StandardSocketOptions.TCP_NODELAY, Net.UNSPEC), new OptionKey(6, 1)); in options() 68 …map.put(new RegistryKey(StandardSocketOptions.IP_TOS, StandardProtocolFamily.INET), new OptionKey(… in options() 69 …map.put(new RegistryKey(StandardSocketOptions.IP_MULTICAST_IF, StandardProtocolFamily.INET), new O… in options() [all …]
|
/libcore/ojluni/src/test/java/time/tck/java/time/format/ |
D | TCKDateTimeTextPrinting.java | 161 Map<Long, String> map = new HashMap<Long, String>(); in test_appendTextMap() local 162 map.put(1L, "JNY"); in test_appendTextMap() 163 map.put(2L, "FBY"); in test_appendTextMap() 164 map.put(3L, "MCH"); in test_appendTextMap() 165 map.put(4L, "APL"); in test_appendTextMap() 166 map.put(5L, "MAY"); in test_appendTextMap() 167 map.put(6L, "JUN"); in test_appendTextMap() 168 map.put(7L, "JLY"); in test_appendTextMap() 169 map.put(8L, "AGT"); in test_appendTextMap() 170 map.put(9L, "SPT"); in test_appendTextMap() [all …]
|
/libcore/luni/src/main/java/libcore/util/ |
D | BasicLruCache.java | 30 private final LinkedHashMap<K, V> map; field in BasicLruCache 39 this.map = new LinkedHashMap<K, V>(0, 0.75f, true); in BasicLruCache() 56 result = map.get(key); in get() 72 map.put(key, result); in get() 95 V previous = map.put(key, value); in put() 101 while (map.size() > maxSize) { in trimToSize() 102 Map.Entry<K, V> toEvict = map.eldest(); in trimToSize() 106 map.remove(key); in trimToSize() 132 return new LinkedHashMap<K, V>(map); in snapshot()
|
/libcore/ojluni/src/main/java/java/time/format/ |
D | DateTimeTextProvider.java | 270 Map<String, Integer> map = CalendarDataUtility.retrieveJavaTimeFieldValueNames( in getTextIterator() local 272 if (map == null) { in getTextIterator() 275 List<Entry<String, Long>> list = new ArrayList<>(map.size()); in getTextIterator() 278 for (Map.Entry<String, Integer> entry : map.entrySet()) { in getTextIterator() 291 for (Map.Entry<String, Integer> entry : map.entrySet()) { in getTextIterator() 296 for (Map.Entry<String, Integer> entry : map.entrySet()) { in getTextIterator() 301 for (Map.Entry<String, Integer> entry : map.entrySet()) { in getTextIterator() 339 Map<Long, String> map = new HashMap<>(); in createStore() local 341 map.put((long) entry.getValue(), entry.getKey()); in createStore() 343 if (!map.isEmpty()) { in createStore() [all …]
|