@Test public void testEqualPopularityOrdering() { EventList<String> source = new BasicEventList<>(); PopularityList<String> popularityList = PopularityList.create(source); source.add(0, "chaos"); source.add(1, "fiery"); source.add(2, "gecko"); source.add(0, "banjo"); source.add(2, "dingo"); source.add(5, "hippo"); source.add(0, "album"); source.add(4, "eerie"); List<String> sortedSingleCopy = new ArrayList<>(); sortedSingleCopy.addAll(source); Collections.sort(sortedSingleCopy); assertEquals(sortedSingleCopy, popularityList); source.add(0, "chaos"); source.add(1, "fiery"); source.add(2, "gecko"); source.add(0, "banjo"); source.add(2, "dingo"); source.add(5, "hippo"); source.add(0, "album"); source.add(4, "eerie"); assertEquals(sortedSingleCopy, popularityList); source.add("chaos"); source.add("fiery"); source.add("gecko"); source.add("banjo"); source.add("dingo"); source.add("hippo"); source.add("album"); source.add("eerie"); assertEquals(sortedSingleCopy, popularityList); source.set(0, "gecko"); source.set(2, "hippo"); source.set(4, "dingo"); source.set(5, "banjo"); List<String> expectedTwoClasses = new ArrayList<>(); expectedTwoClasses.add("banjo"); expectedTwoClasses.add("dingo"); expectedTwoClasses.add("gecko"); expectedTwoClasses.add("hippo"); expectedTwoClasses.add("album"); expectedTwoClasses.add("chaos"); expectedTwoClasses.add("eerie"); expectedTwoClasses.add("fiery"); assertEquals(expectedTwoClasses, popularityList); }
public static <E extends Comparable<? super E>> PopularityList<E> create(EventList<E> source) { return new PopularityList<>(UniqueList.create(source)); }
PopularityList extends TransformedList<E, E> { public static <E extends Comparable<? super E>> PopularityList<E> create(EventList<E> source) { return new PopularityList<>(UniqueList.create(source)); } }
PopularityList extends TransformedList<E, E> { public static <E extends Comparable<? super E>> PopularityList<E> create(EventList<E> source) { return new PopularityList<>(UniqueList.create(source)); } PopularityList(EventList<E> source);  PopularityList(EventList<E> source, Comparator<E> uniqueComparator); private  PopularityList(UniqueList<E> uniqueList); }
PopularityList extends TransformedList<E, E> { public static <E extends Comparable<? super E>> PopularityList<E> create(EventList<E> source) { return new PopularityList<>(UniqueList.create(source)); } PopularityList(EventList<E> source);  PopularityList(EventList<E> source, Comparator<E> uniqueComparator); private  PopularityList(UniqueList<E> uniqueList); static PopularityList<E> create(EventList<E> source); @Override void listChanged(ListEvent<E> listChanges); @Override void dispose(); }
PopularityList extends TransformedList<E, E> { public static <E extends Comparable<? super E>> PopularityList<E> create(EventList<E> source) { return new PopularityList<>(UniqueList.create(source)); } PopularityList(EventList<E> source);  PopularityList(EventList<E> source, Comparator<E> uniqueComparator); private  PopularityList(UniqueList<E> uniqueList); static PopularityList<E> create(EventList<E> source); @Override void listChanged(ListEvent<E> listChanges); @Override void dispose();  }