use of org.eclipse.collections.impl.list.mutable.primitive.IntArrayList in project eclipse-collections by eclipse.
the class CodePointList method collectInt.
public CodePointList collectInt(IntToIntFunction function) {
IntArrayList collected = new IntArrayList(this.size());
for (int i = 0; i < this.size(); i++) {
int codePoint = this.get(i);
collected.add(function.valueOf(codePoint));
}
return new CodePointList(collected.toImmutable());
}
use of org.eclipse.collections.impl.list.mutable.primitive.IntArrayList in project eclipse-collections by eclipse.
the class SortedSetAdapter method collectInt.
@Override
public MutableIntList collectInt(IntFunction<? super T> intFunction) {
IntArrayList result = new IntArrayList(this.size());
this.forEach(new CollectIntProcedure<>(intFunction, result));
return result;
}
use of org.eclipse.collections.impl.list.mutable.primitive.IntArrayList in project eclipse-collections by eclipse.
the class TreeSortedSet method collectInt.
@Override
public MutableIntList collectInt(IntFunction<? super T> intFunction) {
IntArrayList result = new IntArrayList(this.size());
this.forEach(new CollectIntProcedure<>(intFunction, result));
return result;
}
use of org.eclipse.collections.impl.list.mutable.primitive.IntArrayList in project eclipse-collections by eclipse.
the class AbstractListTestCase method forEachWithIndex.
@Override
public void forEachWithIndex() {
super.forEachWithIndex();
MutableList<Integer> elements = FastList.newList();
IntArrayList indexes = new IntArrayList();
MutableList<Integer> collection = this.newWith(1, 2, 3, 4);
collection.forEachWithIndex((Integer object, int index) -> {
elements.add(object);
indexes.add(index);
});
Assert.assertEquals(FastList.newListWith(1, 2, 3, 4), elements);
Assert.assertEquals(IntArrayList.newListWith(0, 1, 2, 3), indexes);
}
use of org.eclipse.collections.impl.list.mutable.primitive.IntArrayList in project eclipse-collections by eclipse.
the class ArrayListAdapter method collectInt.
@Override
public MutableIntList collectInt(IntFunction<? super T> intFunction) {
IntArrayList result = new IntArrayList(this.size());
this.each(each -> result.add(intFunction.intValueOf(each)));
return result;
}
Aggregations