Exemple #1
0
 @Test
 public void notIn() {
   MutableList<String> odds = Lists.fixedSize.of("1", "3");
   Assert.assertFalse(Predicates2.notIn().accept("1", odds));
   Assert.assertTrue(Predicates2.notIn().accept("2", odds));
   Assert.assertNotNull(Predicates2.notIn().toString());
   MutableList<String> list = Lists.fixedSize.of("1", "2");
   MutableList<String> newList = ListIterate.filterWith(list, Predicates2.notIn(), odds);
   Assert.assertEquals(FastList.newListWith("2"), newList);
 }
Exemple #2
0
 @Test
 public void attributeIn_MultiTypes() {
   MutableList<String> stringInts = Lists.fixedSize.of("1", "2");
   Assert.assertTrue(Predicates2.attributeIn(Functions.getToString()).accept(1, stringInts));
   Assert.assertFalse(Predicates2.attributeIn(Functions.getToString()).accept(3, stringInts));
   Assert.assertFalse(Predicates2.attributeIn(Functions.getToString()).accept(3, stringInts));
   MutableList<Integer> intList = Lists.fixedSize.of(1, 3);
   MutableList<Integer> newList =
       ListIterate.filterWith(
           intList, Predicates2.attributeIn(Functions.getToString()), stringInts);
   Assert.assertEquals(FastList.newListWith(1), newList);
 }
Exemple #3
0
 @Test
 public void attributeIn() {
   MutableList<String> upperList = Lists.fixedSize.of("A", "B");
   Assert.assertTrue(
       Predicates2.attributeIn(StringFunctions.toUpperCase()).accept("a", upperList));
   Assert.assertFalse(
       Predicates2.attributeIn(StringFunctions.toUpperCase()).accept("c", upperList));
   MutableList<String> lowerList = Lists.fixedSize.of("a", "c");
   MutableList<String> newList =
       ListIterate.filterWith(
           lowerList, Predicates2.attributeIn(StringFunctions.toUpperCase()), upperList);
   Assert.assertEquals(FastList.newListWith("a"), newList);
 }