use of org.eclipse.collections.api.set.primitive.MutableDoubleSet in project eclipse-collections by eclipse.
the class AbstractMutableSet method collectDouble.
@Override
public MutableDoubleSet collectDouble(DoubleFunction<? super T> doubleFunction) {
MutableDoubleSet result = new DoubleHashSet(this.size());
this.forEach(new CollectDoubleProcedure<>(doubleFunction, result));
return result;
}
use of org.eclipse.collections.api.set.primitive.MutableDoubleSet in project eclipse-collections by eclipse.
the class AbstractImmutableSet method collectDouble.
@Override
public ImmutableDoubleSet collectDouble(DoubleFunction<? super T> doubleFunction) {
MutableDoubleSet result = new DoubleHashSet(this.size());
this.forEach(new CollectDoubleProcedure<>(doubleFunction, result));
return result.toImmutable();
}
use of org.eclipse.collections.api.set.primitive.MutableDoubleSet in project eclipse-collections by eclipse.
the class PrimitiveStreamsTest method toDoubleSet.
@Test
public void toDoubleSet() {
MutableDoubleSet set = PrimitiveStreams.mDoubleSet(DoubleStream.of(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0));
Assert.assertEquals(DoubleSets.mutable.ofAll(IntInterval.oneTo(10).asLazy().collectDouble(i -> (double) i)), set);
Assert.assertEquals(DoubleSets.immutable.ofAll(DoubleStream.of(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0)), set);
}
Aggregations