use of org.eclipse.collections.api.list.primitive.MutableIntList in project eclipse-collections by eclipse.
the class IntLongMapProbeTest method getSmallCollidingNumbers.
private MutableIntList getSmallCollidingNumbers() {
int lower = Integer.MIN_VALUE;
int upper = Integer.MAX_VALUE;
MutableIntList collidingNumbers = new IntArrayList();
int numberOne = this.smallMask(SpreadFunctions.intSpreadOne(0xABCDEF1));
int numberTwo = this.smallMask(SpreadFunctions.intSpreadTwo(0xABCDEF1));
for (int i = lower; i < upper && collidingNumbers.size() < SMALL_COLLIDING_KEY_COUNT; i++) {
if (this.smallMask(SpreadFunctions.intSpreadOne(i)) == numberOne && this.smallMask(SpreadFunctions.intSpreadTwo(i)) == numberTwo) {
collidingNumbers.add(i);
}
}
return collidingNumbers;
}
use of org.eclipse.collections.api.list.primitive.MutableIntList in project eclipse-collections by eclipse.
the class CodePointAdapter method chunk.
@Override
public RichIterable<IntIterable> chunk(int size) {
if (size <= 0) {
throw new IllegalArgumentException("Size for groups must be positive but was: " + size);
}
MutableList<IntIterable> result = Lists.mutable.empty();
if (this.notEmpty()) {
if (this.size() <= size) {
result.add(IntLists.immutable.withAll(this));
} else {
IntIterator iterator = this.intIterator();
while (iterator.hasNext()) {
MutableIntList batch = IntLists.mutable.empty();
for (int i = 0; i < size && iterator.hasNext(); i++) {
batch.add(iterator.next());
}
result.add(CodePointList.from(batch));
}
}
}
return result.toImmutable();
}
use of org.eclipse.collections.api.list.primitive.MutableIntList in project eclipse-collections by eclipse.
the class AbstractListTestCase method collectInt.
@Override
public void collectInt() {
super.collectInt();
MutableIntList result = this.newWith(1, 2, 3, 4).collectInt(PrimitiveFunctions.unboxIntegerToInt());
Assert.assertEquals(IntLists.mutable.of(1, 2, 3, 4), result);
}
use of org.eclipse.collections.api.list.primitive.MutableIntList in project neo4j by neo4j.
the class PartitionedSeekTest method assertEntries.
private static IntList assertEntries(long from, long to, Collection<Seeker<MutableLong, MutableLong>> seekers) throws IOException {
long nextExpected = from;
MutableIntList entryCountPerSeeker = IntLists.mutable.empty();
for (Seeker<MutableLong, MutableLong> seeker : seekers) {
int count = 0;
while (nextExpected < to && seeker.next()) {
assertEquals(nextExpected, seeker.key().longValue());
nextExpected++;
count++;
}
entryCountPerSeeker.add(count);
}
assertEquals(to, nextExpected);
return entryCountPerSeeker;
}
Aggregations