use of org.eclipse.collections.api.set.primitive.ImmutableCharSet in project eclipse-collections by eclipse.
the class StringIterateTest method asCharAdapterExtra.
@Test
public void asCharAdapterExtra() {
Assert.assertEquals(9, StringIterate.asCharAdapter(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG).count(c -> !Character.isLetter(c)));
Assert.assertTrue(StringIterate.asCharAdapter(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG).anySatisfy(Character::isWhitespace));
Assert.assertEquals(8, StringIterate.asCharAdapter(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG).count(Character::isWhitespace));
Verify.assertSize(26, StringIterate.asCharAdapter(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG).asLazy().select(Character::isLetter).collectChar(Character::toLowerCase).toSet());
ImmutableCharSet alphaCharAdapter = StringIterate.asCharAdapter(ALPHABET_LOWERCASE).toSet().toImmutable();
Assert.assertTrue(StringIterate.asCharAdapter(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG).containsAll(alphaCharAdapter));
Assert.assertEquals(CharSets.immutable.empty(), alphaCharAdapter.newWithoutAll(StringIterate.asCharAdapter(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG.toLowerCase())));
Assert.assertEquals(TQBFJOTLD_MINUS_HALF_ABET_1, StringIterate.asCharAdapter(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG.toLowerCase()).newWithoutAll(StringIterate.asCharAdapter(HALF_ABET.getOne())).toString());
Assert.assertEquals(TQBFJOTLD_MINUS_HALF_ABET_2, StringIterate.asCharAdapter(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG.toLowerCase()).newWithoutAll(StringIterate.asCharAdapter(HALF_ABET.getTwo())).toString());
}
Aggregations