@Test public void testAdd() { EventList<String> sourceList = new BasicEventList<>(); GroupingList<String> groupList = GroupingList.create(sourceList); ListConsistencyListener<List<String>> listConsistencyListener = ListConsistencyListener.install(groupList); listConsistencyListener.setPreviousElementTracked(false); assertEquals(0, groupList.size()); sourceList.add("A"); assertEquals(1, groupList.size()); assertEquals(GlazedListsTests.stringToList("A"), groupList.get(0)); sourceList.add(0, "A"); assertEquals(1, groupList.size()); assertEquals(GlazedListsTests.stringToList("AA"), groupList.get(0)); sourceList.add(2, "A"); assertEquals(1, groupList.size()); assertEquals(GlazedListsTests.stringToList("AAA"), groupList.get(0)); sourceList.add("Z"); assertEquals(2, groupList.size()); assertEquals(GlazedListsTests.stringToList("AAA"), groupList.get(0)); assertEquals(GlazedListsTests.stringToList("Z"), groupList.get(1)); sourceList.add(sourceList.size()-2, "Z"); assertEquals(2, groupList.size()); assertEquals(GlazedListsTests.stringToList("AAA"), groupList.get(0)); assertEquals(GlazedListsTests.stringToList("ZZ"), groupList.get(1)); sourceList.add(sourceList.size()-1, "Z"); assertEquals(2, groupList.size()); assertEquals(GlazedListsTests.stringToList("AAA"), groupList.get(0)); assertEquals(GlazedListsTests.stringToList("ZZZ"), groupList.get(1)); sourceList.add("J"); assertEquals(3, groupList.size()); assertEquals(GlazedListsTests.stringToList("AAA"), groupList.get(0)); assertEquals(GlazedListsTests.stringToList("J"), groupList.get(1)); assertEquals(GlazedListsTests.stringToList("ZZZ"), groupList.get(2)); sourceList.add(3, "J"); assertEquals(3, groupList.size()); assertEquals(GlazedListsTests.stringToList("AAA"), groupList.get(0)); assertEquals(GlazedListsTests.stringToList("JJ"), groupList.get(1)); assertEquals(GlazedListsTests.stringToList("ZZZ"), groupList.get(2)); sourceList.add(5, "J"); assertEquals(3, groupList.size()); assertEquals(GlazedListsTests.stringToList("AAA"), groupList.get(0)); assertEquals(GlazedListsTests.stringToList("JJJ"), groupList.get(1)); assertEquals(GlazedListsTests.stringToList("ZZZ"), groupList.get(2)); }
@Override public void add(int index, List<E> value) { source.addAll(value); }
GroupingList extends TransformedList<E, List<E>> { @Override public void add(int index, List<E> value) { source.addAll(value); } }
GroupingList extends TransformedList<E, List<E>> { @Override public void add(int index, List<E> value) { source.addAll(value); } GroupingList(EventList<E> source);  GroupingList(EventList<E> source, Comparator<? super E> comparator); private  GroupingList(SortedList<E> source, Comparator<? super E> comparator, Void dummyParameter); }
GroupingList extends TransformedList<E, List<E>> { @Override public void add(int index, List<E> value) { source.addAll(value); } GroupingList(EventList<E> source);  GroupingList(EventList<E> source, Comparator<? super E> comparator); private  GroupingList(SortedList<E> source, Comparator<? super E> comparator, Void dummyParameter); static GroupingList<E> create(EventList<E> source); int indexOfGroup(E groupElement); void setComparator(Comparator<? super E> comparator); @Override void listChanged(ListEvent<E> listChanges); @Override List<E> get(int index); @Override List<E> remove(int index); @Override List<E> set(int index, List<E> value); @Override void add(int index, List<E> value); @Override int size(); @Override void dispose(); }
GroupingList extends TransformedList<E, List<E>> { @Override public void add(int index, List<E> value) { source.addAll(value); } GroupingList(EventList<E> source);  GroupingList(EventList<E> source, Comparator<? super E> comparator); private  GroupingList(SortedList<E> source, Comparator<? super E> comparator, Void dummyParameter); static GroupingList<E> create(EventList<E> source); int indexOfGroup(E groupElement); void setComparator(Comparator<? super E> comparator); @Override void listChanged(ListEvent<E> listChanges); @Override List<E> get(int index); @Override List<E> remove(int index); @Override List<E> set(int index, List<E> value); @Override void add(int index, List<E> value); @Override int size(); @Override void dispose();  }