Home | History | Annotate | Download | only in collect

Lines Matching refs:map

26 import java.util.Map;
32 * Tests for {@link Maps#transformValues} when the backing map's views
47 final Map<K, V> delegate;
49 UnmodifiableIteratorMap(Map<K, V> delegate) {
53 @Override protected Map<K, V> delegate() {
109 @Override protected Map<String, String> makeEmptyMap() {
110 Map<String, Integer> underlying = Maps.newHashMap();
115 @Override protected Map<String, String> makePopulatedMap() {
116 Map<String, Integer> underlying = Maps.newHashMap();
135 private void assertMapsEqual(Map<?, ?> expected, Map<?, ?> map) {
136 assertEquals(expected, map);
137 assertEquals(expected.hashCode(), map.hashCode());
138 assertEquals(expected.entrySet(), map.entrySet());
143 Collection<?> mapValues = map.values();
150 Map<String, String> map = Maps.transformValues(
152 assertMapsEqual(Maps.newHashMap(), map);
156 Map<String, String> map = Maps.transformValues(
158 Map<String, String> expected = ImmutableMap.of("a", "1");
159 assertMapsEqual(expected, map);
160 assertEquals(expected.get("a"), map.get("a"));
164 Map<String, Integer> underlying = ImmutableMap.of("a", 1);
165 Map<String, Integer> map = Maps.transformValues(
167 assertMapsEqual(underlying, map);
171 Map<String, String> map = Maps.transformValues(
174 map.put("b", "2");
180 map.putAll(ImmutableMap.of("b", "2"));
186 map.entrySet().iterator().next().setValue("one");
193 Map<String, Integer> underlying = Maps.newHashMap();
195 Map<String, String> map
197 assertEquals("1", map.remove("a"));
198 assertNull(map.remove("b"));
202 Map<String, String> underlying = Maps.newHashMap();
206 Map<String, Boolean> map = Maps.transformValues(underlying,
214 Map<String, Boolean> expected = ImmutableMap.of("a", true, "b", false);
215 assertMapsEqual(expected, map);
216 assertEquals(expected.get("a"), map.get("a"));
217 assertEquals(expected.containsKey("a"), map.containsKey("a"));
218 assertEquals(expected.get("b"), map.get("b"));
219 assertEquals(expected.containsKey("b"), map.containsKey("b"));
220 assertEquals(expected.get("c"), map.get("c"));
221 assertEquals(expected.containsKey("c"), map.containsKey("c"));
225 Map<String, Integer> underlying = Maps.newHashMap();
229 Map<String, String> map
231 assertEquals(underlying.size(), map.size());
234 assertEquals(underlying.size(), map.size());
235 assertEquals("4", map.get("d"));
238 assertEquals(underlying.size(), map.size());
239 assertFalse(map.containsKey("c"));
242 assertEquals(underlying.size(), map.size());
246 Map<String, Integer> underlying = Maps.newLinkedHashMap();
254 Map<String, String> map
257 map.remove("a");
260 Set<String> keys = map.keySet();
269 Collection<String> values = map.values();
278 Set<Map.Entry<String, String>> entries = map.entrySet();
279 Map.Entry<String, String> firstEntry = entries.iterator().next();
283 Iterator<Map.Entry<String, String>> entryIterator = entries.iterator();
289 assertTrue(map.isEmpty());
296 Map<String, Integer> underlying = ImmutableMap.of("a", 0, "b", 1, "c", 2);
297 Map<String, Integer> expected
302 Map<String, Integer> equalToUnderlying = Maps.newTreeMap();
304 Map<String, Integer> map = Maps.transformValues(
306 assertMapsEqual(expected, map);
308 map = Maps.transformValues(ImmutableMap.of("a", 1, "b", 2, "c", 3),
316 assertMapsEqual(expected, map);
320 Map<String, Boolean> underlying = Maps.newHashMap();
325 Map<String, Boolean> map = Maps.transformValues(
334 Set<Map.Entry<String, Boolean>> entries = map.entrySet();