Search in sources :

Example 36 with BooleanIterable

use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.

the class ReverseBooleanIterableTest method appendString.

@Test
public void appendString() {
    BooleanIterable iterable = BooleanArrayList.newListWith(false, false, true).asReversed();
    StringBuilder appendable = new StringBuilder();
    new BooleanArrayList().asReversed().appendString(appendable);
    Assert.assertEquals("", appendable.toString());
    StringBuilder appendable2 = new StringBuilder();
    iterable.appendString(appendable2);
    Assert.assertEquals("true, false, false", appendable2.toString());
    StringBuilder appendable3 = new StringBuilder();
    iterable.appendString(appendable3, "/");
    Assert.assertEquals("true/false/false", appendable3.toString());
    StringBuilder appendable4 = new StringBuilder();
    iterable.appendString(appendable4, "[", ", ", "]");
    Assert.assertEquals(iterable.toString(), appendable4.toString());
}
Also used : BooleanIterable(org.eclipse.collections.api.BooleanIterable) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) Test(org.junit.Test)

Example 37 with BooleanIterable

use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.

the class ReverseBooleanIterableTest method makeString.

@Test
public void makeString() {
    BooleanIterable iterable = BooleanArrayList.newListWith(false, false, true).asReversed();
    Assert.assertEquals("true, false, false", iterable.makeString());
    Assert.assertEquals("true", BooleanArrayList.newListWith(true).makeString("/"));
    Assert.assertEquals("true/false/false", iterable.makeString("/"));
    Assert.assertEquals(iterable.toString(), iterable.makeString("[", ", ", "]"));
    Assert.assertEquals("", new BooleanArrayList().asReversed().makeString());
}
Also used : BooleanIterable(org.eclipse.collections.api.BooleanIterable) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) Test(org.junit.Test)

Example 38 with BooleanIterable

use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.

the class ReverseBooleanIterableTest method size.

@Test
public void size() {
    BooleanIterable iterable = BooleanArrayList.newListWith(false, false, true).asReversed();
    Verify.assertSize(0, new BooleanArrayList().asReversed());
    Verify.assertSize(3, iterable);
}
Also used : BooleanIterable(org.eclipse.collections.api.BooleanIterable) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) Test(org.junit.Test)

Example 39 with BooleanIterable

use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.

the class ReverseBooleanIterableTest method testToString.

@Test
public void testToString() {
    BooleanIterable iterable = BooleanArrayList.newListWith(false, false, true).asReversed();
    Assert.assertEquals("[true, false, false]", iterable.toString());
    Assert.assertEquals("[]", new BooleanArrayList().asReversed().toString());
}
Also used : BooleanIterable(org.eclipse.collections.api.BooleanIterable) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) Test(org.junit.Test)

Example 40 with BooleanIterable

use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.

the class ReverseBooleanIterableTest method containsAll.

@Test
public void containsAll() {
    BooleanIterable iterable = BooleanArrayList.newListWith(true, false, true).asReversed();
    Assert.assertTrue(iterable.containsAll(true));
    Assert.assertTrue(iterable.containsAll(true, false));
    Assert.assertFalse(BooleanArrayList.newListWith(false, false).asReversed().containsAll(true));
    Assert.assertFalse(BooleanArrayList.newListWith(false, false).asReversed().containsAll(BooleanArrayList.newListWith(true, false)));
    Assert.assertTrue(BooleanArrayList.newListWith(false, false, true).asReversed().containsAll(BooleanArrayList.newListWith(true, false)));
}
Also used : BooleanIterable(org.eclipse.collections.api.BooleanIterable) Test(org.junit.Test)

Aggregations

BooleanIterable (org.eclipse.collections.api.BooleanIterable)54 Test (org.junit.Test)47 LazyBooleanIterable (org.eclipse.collections.api.LazyBooleanIterable)27 BooleanIterator (org.eclipse.collections.api.iterator.BooleanIterator)11 BooleanArrayList (org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)8 MutableBooleanBag (org.eclipse.collections.api.bag.primitive.MutableBooleanBag)4 MutableBooleanIterator (org.eclipse.collections.api.iterator.MutableBooleanIterator)4 MutableBooleanList (org.eclipse.collections.api.list.primitive.MutableBooleanList)2 ReverseBooleanIterable (org.eclipse.collections.impl.lazy.primitive.ReverseBooleanIterable)2 NoSuchElementException (java.util.NoSuchElementException)1 MutableBooleanCollection (org.eclipse.collections.api.collection.primitive.MutableBooleanCollection)1 BooleanHashBag (org.eclipse.collections.impl.bag.mutable.primitive.BooleanHashBag)1 BooleanPredicates (org.eclipse.collections.impl.block.factory.primitive.BooleanPredicates)1 FastList (org.eclipse.collections.impl.list.mutable.FastList)1 MutableInteger (org.eclipse.collections.impl.math.MutableInteger)1 AbstractBooleanIterable (org.eclipse.collections.impl.primitive.AbstractBooleanIterable)1 SynchronizedBooleanIterable (org.eclipse.collections.impl.primitive.SynchronizedBooleanIterable)1 BooleanHashSet (org.eclipse.collections.impl.set.mutable.primitive.BooleanHashSet)1 Verify (org.eclipse.collections.impl.test.Verify)1 Assert (org.junit.Assert)1