Search in sources :

Example 1 with DoubleList

use of org.eclipse.collections.api.list.primitive.DoubleList in project eclipse-collections by eclipse.

the class Collectors2AdditionalTest method collectDoubleParallel.

@Test
public void collectDoubleParallel() {
    DoubleList expected = LARGE_INTERVAL.collectDouble(Integer::doubleValue, DoubleLists.mutable.empty());
    DoubleList actual = this.bigData.parallelStream().collect(Collectors2.collectDouble(each -> (double) each, DoubleLists.mutable::empty));
    Assert.assertEquals(expected, actual);
}
Also used : BigInteger(java.math.BigInteger) LongLists(org.eclipse.collections.impl.factory.primitive.LongLists) CompositeFastList(org.eclipse.collections.impl.list.mutable.CompositeFastList) LongList(org.eclipse.collections.api.list.primitive.LongList) PartitionMutableBag(org.eclipse.collections.api.partition.bag.PartitionMutableBag) DoubleLists(org.eclipse.collections.impl.factory.primitive.DoubleLists) Verify(org.eclipse.collections.impl.test.Verify) MutableList(org.eclipse.collections.api.list.MutableList) ShortList(org.eclipse.collections.api.list.primitive.ShortList) PartitionMutableSet(org.eclipse.collections.api.partition.set.PartitionMutableSet) ArrayList(java.util.ArrayList) PartitionFastList(org.eclipse.collections.impl.partition.list.PartitionFastList) BigDecimal(java.math.BigDecimal) Functions(org.eclipse.collections.impl.block.factory.Functions) ByteLists(org.eclipse.collections.impl.factory.primitive.ByteLists) Map(java.util.Map) Interval(org.eclipse.collections.impl.list.Interval) PartitionHashBag(org.eclipse.collections.impl.partition.bag.PartitionHashBag) PrimitiveTuples(org.eclipse.collections.impl.tuple.primitive.PrimitiveTuples) BigInteger(java.math.BigInteger) DoubleList(org.eclipse.collections.api.list.primitive.DoubleList) PartitionMutableList(org.eclipse.collections.api.partition.list.PartitionMutableList) Predicates2(org.eclipse.collections.impl.block.factory.Predicates2) CharLists(org.eclipse.collections.impl.factory.primitive.CharLists) CharList(org.eclipse.collections.api.list.primitive.CharList) IntList(org.eclipse.collections.api.list.primitive.IntList) IntegerPredicates(org.eclipse.collections.impl.block.factory.IntegerPredicates) Bags(org.eclipse.collections.impl.factory.Bags) BooleanLists(org.eclipse.collections.impl.factory.primitive.BooleanLists) PartitionUnifiedSet(org.eclipse.collections.impl.partition.set.PartitionUnifiedSet) Test(org.junit.Test) Iterate(org.eclipse.collections.impl.utility.Iterate) Collectors(java.util.stream.Collectors) BooleanList(org.eclipse.collections.api.list.primitive.BooleanList) FloatLists(org.eclipse.collections.impl.factory.primitive.FloatLists) List(java.util.List) ShortLists(org.eclipse.collections.impl.factory.primitive.ShortLists) ByteList(org.eclipse.collections.api.list.primitive.ByteList) IntLists(org.eclipse.collections.impl.factory.primitive.IntLists) FloatList(org.eclipse.collections.api.list.primitive.FloatList) Lists(org.eclipse.collections.impl.factory.Lists) Sets(org.eclipse.collections.impl.factory.Sets) Assert(org.junit.Assert) DoubleList(org.eclipse.collections.api.list.primitive.DoubleList) DoubleLists(org.eclipse.collections.impl.factory.primitive.DoubleLists) Test(org.junit.Test)

Example 2 with DoubleList

use of org.eclipse.collections.api.list.primitive.DoubleList in project eclipse-collections by eclipse.

the class Collectors2AdditionalTest method collectDouble.

@Test
public void collectDouble() {
    DoubleList expected = SMALL_INTERVAL.collectDouble(Integer::doubleValue, DoubleLists.mutable.empty());
    DoubleList actual = this.smallData.stream().collect(Collectors2.collectDouble(each -> (double) each, DoubleLists.mutable::empty));
    Assert.assertEquals(expected, actual);
}
Also used : BigInteger(java.math.BigInteger) LongLists(org.eclipse.collections.impl.factory.primitive.LongLists) CompositeFastList(org.eclipse.collections.impl.list.mutable.CompositeFastList) LongList(org.eclipse.collections.api.list.primitive.LongList) PartitionMutableBag(org.eclipse.collections.api.partition.bag.PartitionMutableBag) DoubleLists(org.eclipse.collections.impl.factory.primitive.DoubleLists) Verify(org.eclipse.collections.impl.test.Verify) MutableList(org.eclipse.collections.api.list.MutableList) ShortList(org.eclipse.collections.api.list.primitive.ShortList) PartitionMutableSet(org.eclipse.collections.api.partition.set.PartitionMutableSet) ArrayList(java.util.ArrayList) PartitionFastList(org.eclipse.collections.impl.partition.list.PartitionFastList) BigDecimal(java.math.BigDecimal) Functions(org.eclipse.collections.impl.block.factory.Functions) ByteLists(org.eclipse.collections.impl.factory.primitive.ByteLists) Map(java.util.Map) Interval(org.eclipse.collections.impl.list.Interval) PartitionHashBag(org.eclipse.collections.impl.partition.bag.PartitionHashBag) PrimitiveTuples(org.eclipse.collections.impl.tuple.primitive.PrimitiveTuples) BigInteger(java.math.BigInteger) DoubleList(org.eclipse.collections.api.list.primitive.DoubleList) PartitionMutableList(org.eclipse.collections.api.partition.list.PartitionMutableList) Predicates2(org.eclipse.collections.impl.block.factory.Predicates2) CharLists(org.eclipse.collections.impl.factory.primitive.CharLists) CharList(org.eclipse.collections.api.list.primitive.CharList) IntList(org.eclipse.collections.api.list.primitive.IntList) IntegerPredicates(org.eclipse.collections.impl.block.factory.IntegerPredicates) Bags(org.eclipse.collections.impl.factory.Bags) BooleanLists(org.eclipse.collections.impl.factory.primitive.BooleanLists) PartitionUnifiedSet(org.eclipse.collections.impl.partition.set.PartitionUnifiedSet) Test(org.junit.Test) Iterate(org.eclipse.collections.impl.utility.Iterate) Collectors(java.util.stream.Collectors) BooleanList(org.eclipse.collections.api.list.primitive.BooleanList) FloatLists(org.eclipse.collections.impl.factory.primitive.FloatLists) List(java.util.List) ShortLists(org.eclipse.collections.impl.factory.primitive.ShortLists) ByteList(org.eclipse.collections.api.list.primitive.ByteList) IntLists(org.eclipse.collections.impl.factory.primitive.IntLists) FloatList(org.eclipse.collections.api.list.primitive.FloatList) Lists(org.eclipse.collections.impl.factory.Lists) Sets(org.eclipse.collections.impl.factory.Sets) Assert(org.junit.Assert) DoubleList(org.eclipse.collections.api.list.primitive.DoubleList) DoubleLists(org.eclipse.collections.impl.factory.primitive.DoubleLists) Test(org.junit.Test)

Aggregations

BigDecimal (java.math.BigDecimal)2 BigInteger (java.math.BigInteger)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Map (java.util.Map)2 Collectors (java.util.stream.Collectors)2 MutableList (org.eclipse.collections.api.list.MutableList)2 BooleanList (org.eclipse.collections.api.list.primitive.BooleanList)2 ByteList (org.eclipse.collections.api.list.primitive.ByteList)2 CharList (org.eclipse.collections.api.list.primitive.CharList)2 DoubleList (org.eclipse.collections.api.list.primitive.DoubleList)2 FloatList (org.eclipse.collections.api.list.primitive.FloatList)2 IntList (org.eclipse.collections.api.list.primitive.IntList)2 LongList (org.eclipse.collections.api.list.primitive.LongList)2 ShortList (org.eclipse.collections.api.list.primitive.ShortList)2 PartitionMutableBag (org.eclipse.collections.api.partition.bag.PartitionMutableBag)2 PartitionMutableList (org.eclipse.collections.api.partition.list.PartitionMutableList)2 PartitionMutableSet (org.eclipse.collections.api.partition.set.PartitionMutableSet)2 Functions (org.eclipse.collections.impl.block.factory.Functions)2 IntegerPredicates (org.eclipse.collections.impl.block.factory.IntegerPredicates)2