Search in sources :

Example 1 with CharArrayList

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

the class CharAdapter method toList.

@Override
public MutableCharList toList() {
    int size = this.size();
    CharArrayList list = new CharArrayList(size);
    for (int i = 0; i < size; i++) {
        list.add(this.get(i));
    }
    return list;
}
Also used : CharArrayList(org.eclipse.collections.impl.list.mutable.primitive.CharArrayList)

Example 2 with CharArrayList

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

the class AbstractLazyIterableTestCase method collectCharWithTarget.

@Test
public void collectCharWithTarget() {
    MutableCharCollection target = new CharArrayList();
    MutableCharCollection result = this.lazyIterable.collectChar(PrimitiveFunctions.unboxIntegerToChar(), target);
    Assert.assertEquals(CharArrayList.newListWith((char) 1, (char) 2, (char) 3, (char) 4, (char) 5, (char) 6, (char) 7), result.toList());
    Assert.assertSame("Target list sent as parameter not returned", target, result);
}
Also used : MutableCharCollection(org.eclipse.collections.api.collection.primitive.MutableCharCollection) CharArrayList(org.eclipse.collections.impl.list.mutable.primitive.CharArrayList) Test(org.junit.Test)

Example 3 with CharArrayList

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

the class AbstractImmutableSortedMap method collectChar.

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

Example 4 with CharArrayList

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

the class RandomAccessListAdapter 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 5 with CharArrayList

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

the class AbstractMutableSortedMap method collectChar.

@Override
public MutableCharList collectChar(CharFunction<? super V> 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)

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