Search in sources :

Example 1 with ShortHashSet

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

the class SetAdapter method collectShort.

@Override
public MutableShortSet collectShort(ShortFunction<? super T> shortFunction) {
    ShortHashSet result = new ShortHashSet(this.size());
    this.forEach(new CollectShortProcedure<>(shortFunction, result));
    return result;
}
Also used : ShortHashSet(org.eclipse.collections.impl.set.mutable.primitive.ShortHashSet)

Example 2 with ShortHashSet

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

the class StackIterableTestCase method collectShortWithTarget.

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

Example 3 with ShortHashSet

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

the class AbstractImmutableSet method collectShort.

@Override
public ImmutableShortSet collectShort(ShortFunction<? super T> shortFunction) {
    MutableShortSet result = new ShortHashSet(this.size());
    this.forEach(new CollectShortProcedure<>(shortFunction, result));
    return result.toImmutable();
}
Also used : MutableShortSet(org.eclipse.collections.api.set.primitive.MutableShortSet) ShortHashSet(org.eclipse.collections.impl.set.mutable.primitive.ShortHashSet)

Example 4 with ShortHashSet

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

the class AbstractMutableSet method collectShort.

@Override
public MutableShortSet collectShort(ShortFunction<? super T> shortFunction) {
    MutableShortSet result = new ShortHashSet(this.size());
    this.forEach(new CollectShortProcedure<>(shortFunction, result));
    return result;
}
Also used : MutableShortSet(org.eclipse.collections.api.set.primitive.MutableShortSet) ShortHashSet(org.eclipse.collections.impl.set.mutable.primitive.ShortHashSet)

Aggregations

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