Search in sources :

Example 1 with ByteHashSet

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

the class AbstractMutableSet method collectByte.

@Override
public MutableByteSet collectByte(ByteFunction<? super T> byteFunction) {
    MutableByteSet result = new ByteHashSet();
    this.forEach(new CollectByteProcedure<>(byteFunction, result));
    return result;
}
Also used : MutableByteSet(org.eclipse.collections.api.set.primitive.MutableByteSet) ByteHashSet(org.eclipse.collections.impl.set.mutable.primitive.ByteHashSet)

Example 2 with ByteHashSet

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

the class SetAdapter method collectByte.

@Override
public MutableByteSet collectByte(ByteFunction<? super T> byteFunction) {
    ByteHashSet result = new ByteHashSet(this.size());
    this.forEach(new CollectByteProcedure<>(byteFunction, result));
    return result;
}
Also used : ByteHashSet(org.eclipse.collections.impl.set.mutable.primitive.ByteHashSet)

Example 3 with ByteHashSet

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

the class AbstractImmutableSet method collectByte.

@Override
public ImmutableByteSet collectByte(ByteFunction<? super T> byteFunction) {
    MutableByteSet result = new ByteHashSet();
    this.forEach(new CollectByteProcedure<>(byteFunction, result));
    return result.toImmutable();
}
Also used : MutableByteSet(org.eclipse.collections.api.set.primitive.MutableByteSet) ByteHashSet(org.eclipse.collections.impl.set.mutable.primitive.ByteHashSet)

Example 4 with ByteHashSet

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

the class StackIterableTestCase method collectByteWithTarget.

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

Aggregations

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