@Test public void testKeySet() { final EventList<String> source = new BasicEventList<>(); final Map<Comparable<String>, List<String>> eventMap = GlazedLists.syncEventListToMultiMap(source, new FirstLetterFunction()); assertTrue(eventMap.isEmpty()); assertTrue(eventMap.keySet().isEmpty()); assertFalse(eventMap.keySet().contains("J")); source.addAll(GlazedListsTests.delimitedStringToList("James Lemieux Jesse Wilson Jodie Ashford Katie Jiries")); assertEquals(8, source.size()); assertEquals(5, eventMap.size()); assertEquals(5, eventMap.keySet().size()); assertEquals(new HashSet<>(Arrays.asList("A", "J", "K", "L", "W")), eventMap.keySet()); assertTrue(eventMap.keySet().contains("A")); assertTrue(eventMap.keySet().contains("J")); assertTrue(eventMap.keySet().contains("K")); assertTrue(eventMap.keySet().contains("L")); assertTrue(eventMap.keySet().contains("W")); assertTrue(eventMap.keySet().remove("W")); assertEquals(7, source.size()); assertEquals(4, eventMap.size()); assertEquals(4, eventMap.keySet().size()); assertEquals(new HashSet<>(Arrays.asList("A", "J", "K", "L")), eventMap.keySet()); assertTrue(eventMap.keySet().remove("J")); assertEquals(3, source.size()); assertEquals(3, eventMap.size()); assertEquals(3, eventMap.keySet().size()); assertEquals(new HashSet<>(Arrays.asList("A", "K", "L")), eventMap.keySet()); try { eventMap.keySet().add("J"); fail("failed to throw an UnsupportedOperationException! Implementing add() makes no sense!"); } catch (UnsupportedOperationException e) { } assertFalse(eventMap.keySet().remove("J")); eventMap.keySet().clear(); assertTrue(eventMap.isEmpty()); assertTrue(eventMap.keySet().isEmpty()); assertFalse(eventMap.keySet().contains("J")); }
@Override public Set<K> keySet() { if (keySet == null) keySet = new KeySet(); return keySet; }
GroupingListMultiMap implements DisposableMap<K, List<V>>, ListEventListener<List<V>> { @Override public Set<K> keySet() { if (keySet == null) keySet = new KeySet(); return keySet; } }
GroupingListMultiMap implements DisposableMap<K, List<V>>, ListEventListener<List<V>> { @Override public Set<K> keySet() { if (keySet == null) keySet = new KeySet(); return keySet; } GroupingListMultiMap(EventList<V> source, FunctionList.Function<V, ? extends K> keyFunction, Comparator<? super K> keyGrouper); }
GroupingListMultiMap implements DisposableMap<K, List<V>>, ListEventListener<List<V>> { @Override public Set<K> keySet() { if (keySet == null) keySet = new KeySet(); return keySet; } GroupingListMultiMap(EventList<V> source, FunctionList.Function<V, ? extends K> keyFunction, Comparator<? super K> keyGrouper); @Override void dispose(); @Override int size(); @Override boolean isEmpty(); @Override boolean containsKey(Object key); @Override boolean containsValue(Object value); @Override List<V> get(Object key); @Override List<V> put(K key, List<V> value); @Override void putAll(Map<? extends K, ? extends List<V>> m); @Override void clear(); @Override List<V> remove(Object key); @Override Collection<List<V>> values(); @Override Set<K> keySet(); @Override Set<Entry<K, List<V>>> entrySet(); @Override boolean equals(Object o); @Override int hashCode(); @Override void listChanged(ListEvent<List<V>> listChanges); }
GroupingListMultiMap implements DisposableMap<K, List<V>>, ListEventListener<List<V>> { @Override public Set<K> keySet() { if (keySet == null) keySet = new KeySet(); return keySet; } GroupingListMultiMap(EventList<V> source, FunctionList.Function<V, ? extends K> keyFunction, Comparator<? super K> keyGrouper); @Override void dispose(); @Override int size(); @Override boolean isEmpty(); @Override boolean containsKey(Object key); @Override boolean containsValue(Object value); @Override List<V> get(Object key); @Override List<V> put(K key, List<V> value); @Override void putAll(Map<? extends K, ? extends List<V>> m); @Override void clear(); @Override List<V> remove(Object key); @Override Collection<List<V>> values(); @Override Set<K> keySet(); @Override Set<Entry<K, List<V>>> entrySet(); @Override boolean equals(Object o); @Override int hashCode(); @Override void listChanged(ListEvent<List<V>> listChanges);  }