コード例 #1
0
 @Test
 public void collectOver100() {
   ArrayList<Integer> list = new ArrayList<Integer>(Interval.oneTo(101));
   ArrayList<Class<?>> newCollection = ArrayListIterate.collect(list, Functions.getToClass());
   Verify.assertSize(101, newCollection);
   Verify.assertContains(Integer.class, newCollection);
 }
コード例 #2
0
 @Test
 public void collect() {
   ArrayList<Boolean> list = new ArrayList<Boolean>();
   list.add(Boolean.TRUE);
   list.add(Boolean.FALSE);
   list.add(Boolean.TRUE);
   list.add(Boolean.TRUE);
   list.add(Boolean.FALSE);
   list.add(null);
   list.add(null);
   list.add(Boolean.FALSE);
   list.add(Boolean.TRUE);
   list.add(null);
   ArrayList<String> newCollection = ArrayListIterate.collect(list, Functions.getToString());
   // List<String> newCollection = ArrayListIterate.collect(list,
   // ArrayListIterateTest.TO_STRING_FUNCTION);
   Verify.assertSize(10, newCollection);
   Verify.assertContainsAll(newCollection, "null", "false", "true");
 }