use of org.eclipse.collections.api.set.primitive.MutableByteSet 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;
}
use of org.eclipse.collections.api.set.primitive.MutableByteSet in project eclipse-collections by eclipse.
the class ByteHashSet method reject.
@Override
public MutableByteSet reject(BytePredicate predicate) {
MutableByteSet result = new ByteHashSet();
this.forEach(value -> {
if (!predicate.accept(value)) {
result.add(value);
}
});
return result;
}
use of org.eclipse.collections.api.set.primitive.MutableByteSet in project eclipse-collections by eclipse.
the class ByteHashSet method chunk.
@Override
public RichIterable<ByteIterable> chunk(int size) {
if (size <= 0) {
throw new IllegalArgumentException("Size for groups must be positive but was: " + size);
}
MutableList<ByteIterable> result = Lists.mutable.empty();
if (this.notEmpty()) {
if (this.size() <= size) {
result.add(ByteSets.mutable.withAll(this));
} else {
ByteIterator iterator = this.byteIterator();
while (iterator.hasNext()) {
MutableByteSet batch = ByteSets.mutable.empty();
for (int i = 0; i < size && iterator.hasNext(); i++) {
batch.add(iterator.next());
}
result.add(batch);
}
}
}
return result;
}
use of org.eclipse.collections.api.set.primitive.MutableByteSet 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();
}
use of org.eclipse.collections.api.set.primitive.MutableByteSet in project eclipse-collections by eclipse.
the class AbstractByteSetTestCase method byteIterator_throws.
@Override
@Test(expected = NoSuchElementException.class)
public void byteIterator_throws() {
MutableByteSet set = this.newWith((byte) 0, (byte) 1, (byte) 31, (byte) -1, (byte) -31);
ByteIterator iterator = set.byteIterator();
while (iterator.hasNext()) {
iterator.next();
}
iterator.next();
}
Aggregations