Пример #1
0
 @Test
 public void collect_target() {
   ImmutableBag<String> strings = this.newBag();
   HashBag<String> target = HashBag.<String>newBag();
   HashBag<String> actual = strings.collect(Functions.getStringPassThru(), target);
   Assert.assertEquals(strings, actual);
   Assert.assertSame(target, actual);
   Assert.assertEquals(
       strings,
       strings.collect(Functions.getStringPassThru(), FastList.<String>newList()).toBag());
 }
Пример #2
0
 @Test
 public void selectByOccurrences() {
   ImmutableBag<String> strings = this.newBag().selectByOccurrences(IntPredicates.isEven());
   ImmutableBag<Integer> collect = strings.collect(Integer::valueOf);
   Verify.assertAllSatisfy(collect, IntegerPredicates.isEven());
 }