Search in sources :

Example 16 with CharArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.CharArrayList in project eclipse-collections by eclipse.

the class ArrayListIterateTest method collectCharOverOptimizeLimit.

@Test
public void collectCharOverOptimizeLimit() {
    ArrayList<Integer> list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT));
    MutableCharList actual = ArrayListIterate.collectChar(list, PrimitiveFunctions.unboxIntegerToChar());
    CharArrayList expected = new CharArrayList(list.size());
    for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) {
        expected.add((char) i);
    }
    Assert.assertEquals(expected, actual);
}
Also used : MutableCharList(org.eclipse.collections.api.list.primitive.MutableCharList) CharArrayList(org.eclipse.collections.impl.list.mutable.primitive.CharArrayList) DoubleArrayList(org.eclipse.collections.impl.list.mutable.primitive.DoubleArrayList) ShortArrayList(org.eclipse.collections.impl.list.mutable.primitive.ShortArrayList) IntArrayList(org.eclipse.collections.impl.list.mutable.primitive.IntArrayList) ByteArrayList(org.eclipse.collections.impl.list.mutable.primitive.ByteArrayList) CharArrayList(org.eclipse.collections.impl.list.mutable.primitive.CharArrayList) FloatArrayList(org.eclipse.collections.impl.list.mutable.primitive.FloatArrayList) LongArrayList(org.eclipse.collections.impl.list.mutable.primitive.LongArrayList) ArrayList(java.util.ArrayList) BooleanArrayList(org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList) Test(org.junit.Test)

Example 17 with CharArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.CharArrayList in project eclipse-collections by eclipse.

the class SortedSetAdapter method collectChar.

@Override
public MutableCharList collectChar(CharFunction<? super T> charFunction) {
    CharArrayList result = new CharArrayList(this.size());
    this.forEach(new CollectCharProcedure<>(charFunction, result));
    return result;
}
Also used : CharArrayList(org.eclipse.collections.impl.list.mutable.primitive.CharArrayList)

Example 18 with CharArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.CharArrayList in project eclipse-collections by eclipse.

the class TreeSortedSet method collectChar.

@Override
public MutableCharList collectChar(CharFunction<? super T> charFunction) {
    CharArrayList result = new CharArrayList(this.size());
    this.forEach(new CollectCharProcedure<>(charFunction, result));
    return result;
}
Also used : CharArrayList(org.eclipse.collections.impl.list.mutable.primitive.CharArrayList)

Example 19 with CharArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.CharArrayList in project eclipse-collections by eclipse.

the class ArrayListAdapter method collectChar.

@Override
public MutableCharList collectChar(CharFunction<? super T> charFunction) {
    CharArrayList result = new CharArrayList(this.size());
    this.each(each -> result.add(charFunction.charValueOf(each)));
    return result;
}
Also used : CharArrayList(org.eclipse.collections.impl.list.mutable.primitive.CharArrayList)

Example 20 with CharArrayList

use of org.eclipse.collections.impl.list.mutable.primitive.CharArrayList in project eclipse-collections by eclipse.

the class ImmutableEmptySortedBagTest method collectChar.

@Override
@Test
public void collectChar() {
    ImmutableSortedBag<Integer> bag = this.classUnderTest();
    Assert.assertEquals(new CharArrayList(), bag.collectChar(PrimitiveFunctions.unboxIntegerToChar()));
}
Also used : CharArrayList(org.eclipse.collections.impl.list.mutable.primitive.CharArrayList) Test(org.junit.Test)

Aggregations

CharArrayList (org.eclipse.collections.impl.list.mutable.primitive.CharArrayList)20 Test (org.junit.Test)10 MutableCharCollection (org.eclipse.collections.api.collection.primitive.MutableCharCollection)3 MutableCharList (org.eclipse.collections.api.list.primitive.MutableCharList)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 DoubleArrayList (org.eclipse.collections.impl.list.mutable.primitive.DoubleArrayList)2 FloatArrayList (org.eclipse.collections.impl.list.mutable.primitive.FloatArrayList)2 IntArrayList (org.eclipse.collections.impl.list.mutable.primitive.IntArrayList)2 LongArrayList (org.eclipse.collections.impl.list.mutable.primitive.LongArrayList)2 ShortArrayList (org.eclipse.collections.impl.list.mutable.primitive.ShortArrayList)2 BigInteger (java.math.BigInteger)1 CharIterable (org.eclipse.collections.api.CharIterable)1 MutableBag (org.eclipse.collections.api.bag.MutableBag)1 Function (org.eclipse.collections.api.block.function.Function)1 CharProcedure (org.eclipse.collections.api.block.procedure.primitive.CharProcedure)1 MutableList (org.eclipse.collections.api.list.MutableList)1 CharList (org.eclipse.collections.api.list.primitive.CharList)1 ImmutableCharList (org.eclipse.collections.api.list.primitive.ImmutableCharList)1