Search in sources :

Example 1 with ImmutableDoubleCollection

use of org.eclipse.collections.api.collection.primitive.ImmutableDoubleCollection in project eclipse-collections by eclipse.

the class AbstractImmutableCollectionTestCase method collectDouble.

@Test
public void collectDouble() {
    ImmutableCollection<Integer> integers = this.classUnderTest();
    ImmutableDoubleCollection immutableCollection = integers.collectDouble(PrimitiveFunctions.unboxIntegerToDouble());
    Verify.assertSize(integers.size(), immutableCollection);
    Assert.assertEquals(integers, immutableCollection.collect(doubleParameter -> Integer.valueOf((int) doubleParameter)));
}
Also used : Predicate(org.eclipse.collections.api.block.predicate.Predicate) SortedBags(org.eclipse.collections.impl.factory.SortedBags) Verify(org.eclipse.collections.impl.test.Verify) MutableBag(org.eclipse.collections.api.bag.MutableBag) MutableList(org.eclipse.collections.api.list.MutableList) ImmutableBooleanCollection(org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection) ImmutableDoubleCollection(org.eclipse.collections.api.collection.primitive.ImmutableDoubleCollection) RichIterable(org.eclipse.collections.api.RichIterable) ImmutableLongCollection(org.eclipse.collections.api.collection.primitive.ImmutableLongCollection) ImmutableShortCollection(org.eclipse.collections.api.collection.primitive.ImmutableShortCollection) Functions(org.eclipse.collections.impl.block.factory.Functions) Interval(org.eclipse.collections.impl.list.Interval) Comparators(org.eclipse.collections.impl.block.factory.Comparators) Collection(java.util.Collection) Procedures(org.eclipse.collections.impl.block.factory.Procedures) ImmutableObjectLongMap(org.eclipse.collections.api.map.primitive.ImmutableObjectLongMap) MutableSortedSet(org.eclipse.collections.api.set.sorted.MutableSortedSet) TreeSortedSet(org.eclipse.collections.impl.set.sorted.mutable.TreeSortedSet) Procedure2(org.eclipse.collections.api.block.procedure.Procedure2) Iterables.iList(org.eclipse.collections.impl.factory.Iterables.iList) Lists(org.eclipse.collections.impl.factory.Lists) Optional(java.util.Optional) ImmutableIntCollection(org.eclipse.collections.api.collection.primitive.ImmutableIntCollection) Bag(org.eclipse.collections.api.bag.Bag) ImmutableCollection(org.eclipse.collections.api.collection.ImmutableCollection) PartitionImmutableCollection(org.eclipse.collections.api.partition.PartitionImmutableCollection) Supplier(java.util.function.Supplier) FastList(org.eclipse.collections.impl.list.mutable.FastList) Function0(org.eclipse.collections.api.block.function.Function0) Function2(org.eclipse.collections.api.block.function.Function2) ImmutableObjectDoubleMap(org.eclipse.collections.api.map.primitive.ImmutableObjectDoubleMap) NoSuchElementException(java.util.NoSuchElementException) MutableCollection(org.eclipse.collections.api.collection.MutableCollection) ImmutableCharCollection(org.eclipse.collections.api.collection.primitive.ImmutableCharCollection) PrimitiveFunctions(org.eclipse.collections.impl.block.factory.PrimitiveFunctions) Predicates(org.eclipse.collections.impl.block.factory.Predicates) Counter(org.eclipse.collections.impl.Counter) Predicates2(org.eclipse.collections.impl.block.factory.Predicates2) Collectors2(org.eclipse.collections.impl.collector.Collectors2) Iterator(java.util.Iterator) ImmutableByteCollection(org.eclipse.collections.api.collection.primitive.ImmutableByteCollection) IntegerPredicates(org.eclipse.collections.impl.block.factory.IntegerPredicates) Bags(org.eclipse.collections.impl.factory.Bags) Test(org.junit.Test) PassThruFunction0(org.eclipse.collections.impl.block.function.PassThruFunction0) MapIterable(org.eclipse.collections.api.map.MapIterable) AddFunction(org.eclipse.collections.impl.block.function.AddFunction) ImmutableFloatCollection(org.eclipse.collections.api.collection.primitive.ImmutableFloatCollection) Assert(org.junit.Assert) Collections(java.util.Collections) ImmutableDoubleCollection(org.eclipse.collections.api.collection.primitive.ImmutableDoubleCollection) Test(org.junit.Test)

Aggregations

Collection (java.util.Collection)1 Collections (java.util.Collections)1 Iterator (java.util.Iterator)1 NoSuchElementException (java.util.NoSuchElementException)1 Optional (java.util.Optional)1 Supplier (java.util.function.Supplier)1 RichIterable (org.eclipse.collections.api.RichIterable)1 Bag (org.eclipse.collections.api.bag.Bag)1 MutableBag (org.eclipse.collections.api.bag.MutableBag)1 Function0 (org.eclipse.collections.api.block.function.Function0)1 Function2 (org.eclipse.collections.api.block.function.Function2)1 Predicate (org.eclipse.collections.api.block.predicate.Predicate)1 Procedure2 (org.eclipse.collections.api.block.procedure.Procedure2)1 ImmutableCollection (org.eclipse.collections.api.collection.ImmutableCollection)1 MutableCollection (org.eclipse.collections.api.collection.MutableCollection)1 ImmutableBooleanCollection (org.eclipse.collections.api.collection.primitive.ImmutableBooleanCollection)1 ImmutableByteCollection (org.eclipse.collections.api.collection.primitive.ImmutableByteCollection)1 ImmutableCharCollection (org.eclipse.collections.api.collection.primitive.ImmutableCharCollection)1 ImmutableDoubleCollection (org.eclipse.collections.api.collection.primitive.ImmutableDoubleCollection)1 ImmutableFloatCollection (org.eclipse.collections.api.collection.primitive.ImmutableFloatCollection)1