Search in sources :

Example 1 with ImmutableLongBag

use of org.eclipse.collections.api.bag.primitive.ImmutableLongBag in project eclipse-collections by eclipse.

the class ImmutableBagTestCase method collectLong.

@Override
@Test
public void collectLong() {
    super.collectLong();
    ImmutableLongBag result = this.newBag().collectLong(Long::parseLong);
    Assert.assertEquals(this.numKeys(), result.sizeDistinct());
    for (int i = 1; i <= this.numKeys(); i++) {
        Assert.assertEquals(i, result.occurrencesOf(i));
    }
}
Also used : ImmutableLongBag(org.eclipse.collections.api.bag.primitive.ImmutableLongBag) Test(org.junit.Test)

Example 2 with ImmutableLongBag

use of org.eclipse.collections.api.bag.primitive.ImmutableLongBag in project eclipse-collections by eclipse.

the class PrimitiveStreamsTest method toImmutableLongBag.

@Test
public void toImmutableLongBag() {
    ImmutableLongBag bag = PrimitiveStreams.iLongBag(LongStream.rangeClosed(1, 10));
    Assert.assertEquals(IntInterval.oneTo(10).collectLong(i -> (long) i, LongBags.mutable.empty()), bag);
    Assert.assertEquals(LongBags.mutable.ofAll(LongStream.rangeClosed(1, 10)), bag);
}
Also used : IntStream(java.util.stream.IntStream) ImmutableLongList(org.eclipse.collections.api.list.primitive.ImmutableLongList) LongLists(org.eclipse.collections.impl.factory.primitive.LongLists) ImmutableIntStack(org.eclipse.collections.api.stack.primitive.ImmutableIntStack) MutableIntBag(org.eclipse.collections.api.bag.primitive.MutableIntBag) ImmutableDoubleList(org.eclipse.collections.api.list.primitive.ImmutableDoubleList) DoubleLists(org.eclipse.collections.impl.factory.primitive.DoubleLists) MutableIntList(org.eclipse.collections.api.list.primitive.MutableIntList) MutableLongList(org.eclipse.collections.api.list.primitive.MutableLongList) MutableDoubleStack(org.eclipse.collections.api.stack.primitive.MutableDoubleStack) IntSets(org.eclipse.collections.impl.factory.primitive.IntSets) ImmutableDoubleBag(org.eclipse.collections.api.bag.primitive.ImmutableDoubleBag) DoubleSets(org.eclipse.collections.impl.factory.primitive.DoubleSets) MutableIntSet(org.eclipse.collections.api.set.primitive.MutableIntSet) ImmutableLongSet(org.eclipse.collections.api.set.primitive.ImmutableLongSet) IntStacks(org.eclipse.collections.impl.factory.primitive.IntStacks) ImmutableDoubleStack(org.eclipse.collections.api.stack.primitive.ImmutableDoubleStack) ImmutableIntBag(org.eclipse.collections.api.bag.primitive.ImmutableIntBag) LongStream(java.util.stream.LongStream) MutableLongBag(org.eclipse.collections.api.bag.primitive.MutableLongBag) MutableDoubleSet(org.eclipse.collections.api.set.primitive.MutableDoubleSet) LongStacks(org.eclipse.collections.impl.factory.primitive.LongStacks) DoubleStacks(org.eclipse.collections.impl.factory.primitive.DoubleStacks) ImmutableDoubleSet(org.eclipse.collections.api.set.primitive.ImmutableDoubleSet) MutableIntStack(org.eclipse.collections.api.stack.primitive.MutableIntStack) Test(org.junit.Test) ImmutableIntList(org.eclipse.collections.api.list.primitive.ImmutableIntList) LongBags(org.eclipse.collections.impl.factory.primitive.LongBags) DoubleStream(java.util.stream.DoubleStream) MutableLongSet(org.eclipse.collections.api.set.primitive.MutableLongSet) IntLists(org.eclipse.collections.impl.factory.primitive.IntLists) MutableDoubleList(org.eclipse.collections.api.list.primitive.MutableDoubleList) MutableLongStack(org.eclipse.collections.api.stack.primitive.MutableLongStack) IntInterval(org.eclipse.collections.impl.list.primitive.IntInterval) ImmutableLongBag(org.eclipse.collections.api.bag.primitive.ImmutableLongBag) LongSets(org.eclipse.collections.impl.factory.primitive.LongSets) ImmutableLongStack(org.eclipse.collections.api.stack.primitive.ImmutableLongStack) ImmutableIntSet(org.eclipse.collections.api.set.primitive.ImmutableIntSet) DoubleBags(org.eclipse.collections.impl.factory.primitive.DoubleBags) Assert(org.junit.Assert) IntBags(org.eclipse.collections.impl.factory.primitive.IntBags) MutableDoubleBag(org.eclipse.collections.api.bag.primitive.MutableDoubleBag) ImmutableLongBag(org.eclipse.collections.api.bag.primitive.ImmutableLongBag) Test(org.junit.Test)

Aggregations

ImmutableLongBag (org.eclipse.collections.api.bag.primitive.ImmutableLongBag)2 Test (org.junit.Test)2 DoubleStream (java.util.stream.DoubleStream)1 IntStream (java.util.stream.IntStream)1 LongStream (java.util.stream.LongStream)1 ImmutableDoubleBag (org.eclipse.collections.api.bag.primitive.ImmutableDoubleBag)1 ImmutableIntBag (org.eclipse.collections.api.bag.primitive.ImmutableIntBag)1 MutableDoubleBag (org.eclipse.collections.api.bag.primitive.MutableDoubleBag)1 MutableIntBag (org.eclipse.collections.api.bag.primitive.MutableIntBag)1 MutableLongBag (org.eclipse.collections.api.bag.primitive.MutableLongBag)1 ImmutableDoubleList (org.eclipse.collections.api.list.primitive.ImmutableDoubleList)1 ImmutableIntList (org.eclipse.collections.api.list.primitive.ImmutableIntList)1 ImmutableLongList (org.eclipse.collections.api.list.primitive.ImmutableLongList)1 MutableDoubleList (org.eclipse.collections.api.list.primitive.MutableDoubleList)1 MutableIntList (org.eclipse.collections.api.list.primitive.MutableIntList)1 MutableLongList (org.eclipse.collections.api.list.primitive.MutableLongList)1 ImmutableDoubleSet (org.eclipse.collections.api.set.primitive.ImmutableDoubleSet)1 ImmutableIntSet (org.eclipse.collections.api.set.primitive.ImmutableIntSet)1 ImmutableLongSet (org.eclipse.collections.api.set.primitive.ImmutableLongSet)1 MutableDoubleSet (org.eclipse.collections.api.set.primitive.MutableDoubleSet)1