Search in sources :

Example 1 with DoubleHashSet

use of org.eclipse.collections.impl.set.mutable.primitive.DoubleHashSet 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;
}
Also used : DoubleHashSet(org.eclipse.collections.impl.set.mutable.primitive.DoubleHashSet) MutableDoubleSet(org.eclipse.collections.api.set.primitive.MutableDoubleSet)

Example 2 with DoubleHashSet

use of org.eclipse.collections.impl.set.mutable.primitive.DoubleHashSet in project eclipse-collections by eclipse.

the class StackIterableTestCase method collectDoubleWithTarget.

@Override
@Test
public void collectDoubleWithTarget() {
    DoubleHashSet target = new DoubleHashSet();
    StackIterable<Integer> stack = this.newStackFromTopToBottom(1, 2, 3);
    DoubleHashSet result = stack.collectDouble(PrimitiveFunctions.unboxIntegerToDouble(), target);
    Assert.assertEquals(DoubleHashSet.newSetWith(1, 2, 3), result);
    Assert.assertSame("Target sent as parameter not returned", target, result);
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) DoubleHashSet(org.eclipse.collections.impl.set.mutable.primitive.DoubleHashSet) Test(org.junit.Test)

Example 3 with DoubleHashSet

use of org.eclipse.collections.impl.set.mutable.primitive.DoubleHashSet 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();
}
Also used : DoubleHashSet(org.eclipse.collections.impl.set.mutable.primitive.DoubleHashSet) MutableDoubleSet(org.eclipse.collections.api.set.primitive.MutableDoubleSet)

Example 4 with DoubleHashSet

use of org.eclipse.collections.impl.set.mutable.primitive.DoubleHashSet in project eclipse-collections by eclipse.

the class SetAdapter method collectDouble.

@Override
public MutableDoubleSet collectDouble(DoubleFunction<? super T> doubleFunction) {
    DoubleHashSet result = new DoubleHashSet(this.size());
    this.forEach(new CollectDoubleProcedure<>(doubleFunction, result));
    return result;
}
Also used : DoubleHashSet(org.eclipse.collections.impl.set.mutable.primitive.DoubleHashSet)

Aggregations

DoubleHashSet (org.eclipse.collections.impl.set.mutable.primitive.DoubleHashSet)4 MutableDoubleSet (org.eclipse.collections.api.set.primitive.MutableDoubleSet)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Test (org.junit.Test)1