@Test public void testConstructor() { try { GlazedLists.transformByFunction(new BasicEventList<String>(), null); fail("failed to receive an NullPointerException with null Function"); } catch (NullPointerException e) {} BasicEventList<String> source = new BasicEventList<>(); EventList<String> firstLetters = GlazedLists.transformByFunction(source, GlazedListsTests.getFirstLetterFunction()); assertEquals(0, firstLetters.size()); source.add(ZERO); source.add(ONE); source.add(TWO); assertEquals(3, firstLetters.size()); assertEquals("Z", firstLetters.get(0)); assertEquals("O", firstLetters.get(1)); assertEquals("T", firstLetters.get(2)); firstLetters = GlazedLists.transformByFunction(source, GlazedListsTests.getFirstLetterFunction()); assertEquals(3, firstLetters.size()); assertEquals("Z", firstLetters.get(0)); assertEquals("O", firstLetters.get(1)); assertEquals("T", firstLetters.get(2)); }
@Override public E get(int index) { final S elem = source.get(index); return function.evaluate(elem); }
SimpleFunctionList extends TransformedList<S, E> { @Override public E get(int index) { final S elem = source.get(index); return function.evaluate(elem); } }
SimpleFunctionList extends TransformedList<S, E> { @Override public E get(int index) { final S elem = source.get(index); return function.evaluate(elem); } SimpleFunctionList(EventList<S> source, Function<S, E> function); }
SimpleFunctionList extends TransformedList<S, E> { @Override public E get(int index) { final S elem = source.get(index); return function.evaluate(elem); } SimpleFunctionList(EventList<S> source, Function<S, E> function); @Override E get(int index); @Override void listChanged(ListEvent<S> listChanges); }
SimpleFunctionList extends TransformedList<S, E> { @Override public E get(int index) { final S elem = source.get(index); return function.evaluate(elem); } SimpleFunctionList(EventList<S> source, Function<S, E> function); @Override E get(int index); @Override void listChanged(ListEvent<S> listChanges);  }