Search in sources :

Example 31 with IntArrayList

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());
}
Also used : IntArrayList(org.eclipse.collections.impl.list.mutable.primitive.IntArrayList)

Example 32 with IntArrayList

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;
}
Also used : IntArrayList(org.eclipse.collections.impl.list.mutable.primitive.IntArrayList)

Example 33 with IntArrayList

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;
}
Also used : IntArrayList(org.eclipse.collections.impl.list.mutable.primitive.IntArrayList)

Example 34 with IntArrayList

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);
}
Also used : IntArrayList(org.eclipse.collections.impl.list.mutable.primitive.IntArrayList)

Example 35 with IntArrayList

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;
}
Also used : IntArrayList(org.eclipse.collections.impl.list.mutable.primitive.IntArrayList)

Aggregations

IntArrayList (org.eclipse.collections.impl.list.mutable.primitive.IntArrayList)35 Test (org.junit.Test)10 MutableIntList (org.eclipse.collections.api.list.primitive.MutableIntList)8 MutableIntCollection (org.eclipse.collections.api.collection.primitive.MutableIntCollection)3 ArrayList (java.util.ArrayList)2 BooleanArrayList (org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)2 ByteArrayList (org.eclipse.collections.impl.list.mutable.primitive.ByteArrayList)2 CharArrayList (org.eclipse.collections.impl.list.mutable.primitive.CharArrayList)2 DoubleArrayList (org.eclipse.collections.impl.list.mutable.primitive.DoubleArrayList)2 FloatArrayList (org.eclipse.collections.impl.list.mutable.primitive.FloatArrayList)2 LongArrayList (org.eclipse.collections.impl.list.mutable.primitive.LongArrayList)2 ShortArrayList (org.eclipse.collections.impl.list.mutable.primitive.ShortArrayList)2 Nullable (org.jetbrains.annotations.Nullable)2 FingerPrint (il.technion.tinytable.hash.FingerPrint)1 java.io (java.io)1 BigInteger (java.math.BigInteger)1 java.util (java.util)1 BitSet (java.util.BitSet)1 Predicate (java.util.function.Predicate)1 ScriptException (javax.script.ScriptException)1