use of org.eclipse.collections.api.set.primitive.ImmutableIntSet in project eclipse-collections by eclipse.
the class StringIterateTest method asCodePointAdapterExtra.
@Test
public void asCodePointAdapterExtra() {
Assert.assertEquals(9, StringIterate.asCodePointAdapter(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG).count(i -> !Character.isLetter(i)));
Assert.assertTrue(StringIterate.asCodePointAdapter(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG).anySatisfy(Character::isWhitespace));
Assert.assertEquals(8, StringIterate.asCodePointAdapter(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG).count(Character::isWhitespace));
Verify.assertSize(26, StringIterate.asCodePointAdapter(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG).asLazy().select(Character::isLetter).collectInt(Character::toLowerCase).toSet());
ImmutableIntSet alphaints = StringIterate.asCodePointAdapter(ALPHABET_LOWERCASE).toSet().toImmutable();
Assert.assertTrue(StringIterate.asCodePointAdapter(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG).containsAll(alphaints));
Assert.assertEquals(IntSets.immutable.empty(), alphaints.newWithoutAll(StringIterate.asCodePointAdapter(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG.toLowerCase())));
Assert.assertEquals(TQBFJOTLD_MINUS_HALF_ABET_1, StringIterate.asCodePointAdapter(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG.toLowerCase()).newWithoutAll(StringIterate.asCodePointAdapter(HALF_ABET.getOne())).toString());
Assert.assertEquals(TQBFJOTLD_MINUS_HALF_ABET_2, StringIterate.asCodePointAdapter(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG.toLowerCase()).newWithoutAll(StringIterate.asCodePointAdapter(HALF_ABET.getTwo())).toString());
}
use of org.eclipse.collections.api.set.primitive.ImmutableIntSet in project eclipse-collections by eclipse.
the class PrimitiveStreamsTest method toImmutableIntSet.
@Test
public void toImmutableIntSet() {
ImmutableIntSet set = PrimitiveStreams.iIntSet(IntStream.rangeClosed(1, 10));
Assert.assertEquals(IntInterval.oneTo(10).toSet(), set);
Assert.assertEquals(IntSets.mutable.ofAll(IntStream.rangeClosed(1, 10)), set);
}
use of org.eclipse.collections.api.set.primitive.ImmutableIntSet in project eclipse-collections by eclipse.
the class StringIterateTest method toCodePointListExtra.
@Test
public void toCodePointListExtra() {
Assert.assertEquals(9, StringIterate.toCodePointList(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG).count(i -> !Character.isLetter(i)));
Assert.assertTrue(StringIterate.toCodePointList(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG).anySatisfy(Character::isWhitespace));
Assert.assertEquals(8, StringIterate.toCodePointList(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG).count(Character::isWhitespace));
Verify.assertSize(26, StringIterate.toCodePointList(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG).asLazy().select(Character::isLetter).collectInt(Character::toLowerCase).toSet());
ImmutableIntSet alphaints = StringIterate.toCodePointList(ALPHABET_LOWERCASE).toSet().toImmutable();
Assert.assertTrue(StringIterate.toCodePointList(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG).containsAll(alphaints));
Assert.assertEquals(IntSets.immutable.empty(), alphaints.newWithoutAll(StringIterate.toCodePointList(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG.toLowerCase())));
Assert.assertTrue(StringIterate.toCodePointList(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG).containsAll(StringIterate.toCodePointList(HALF_ABET.getOne())));
Assert.assertEquals(TQBFJOTLD_MINUS_HALF_ABET_1, StringIterate.toCodePointList(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG.toLowerCase()).newWithoutAll(StringIterate.toCodePointList(HALF_ABET.getOne())).toString());
Assert.assertEquals(TQBFJOTLD_MINUS_HALF_ABET_2, StringIterate.toCodePointList(THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG.toLowerCase()).newWithoutAll(StringIterate.toCodePointList(HALF_ABET.getTwo())).toString());
}
Aggregations