@Test public void without() { MutableList<Integer> list = new SingletonList<>(2); Assert.assertSame(list, list.without(9)); list = list.without(2); Verify.assertListsEqual(Lists.mutable.of(), list); Verify.assertInstanceOf(EmptyList.class, list); }
@Test public void bind() { MutableList<Integer> list = Lists.mutable.of(1, 2, 3); Predicate<Integer> predicate = Predicates.bind((element, parameter) -> (element + parameter) % 2 == 0, 1); Verify.assertListsEqual(Lists.mutable.of(1, 3), list.select(predicate)); assertToString(predicate); }
@Test public void flatCollect() { Function<Integer, MutableSet<String>> function = object -> UnifiedSet.newSetWith(object.toString()); Verify.assertListsEqual( FastList.newListWith("1"), SingletonListTest.newWith(1).flatCollect(function)); Verify.assertSetsEqual( UnifiedSet.newSetWith("1"), SingletonListTest.newWith(1).flatCollect(function, UnifiedSet.<String>newSet())); }