Search in sources :

Example 1 with MutableCharList

use of org.eclipse.collections.api.list.primitive.MutableCharList in project eclipse-collections by eclipse.

the class CharAdapter method newWithoutAll.

@Override
public CharAdapter newWithoutAll(CharIterable elements) {
    MutableCharList mutableCharList = this.toList();
    mutableCharList.removeAll(elements);
    return new CharAdapter(new String(mutableCharList.toArray()));
}
Also used : MutableCharList(org.eclipse.collections.api.list.primitive.MutableCharList)

Example 2 with MutableCharList

use of org.eclipse.collections.api.list.primitive.MutableCharList in project eclipse-collections by eclipse.

the class CharAdapter method newWithAll.

@Override
public CharAdapter newWithAll(CharIterable elements) {
    MutableCharList mutableCharList = this.toList();
    mutableCharList.addAll(elements);
    return new CharAdapter(new String(mutableCharList.toArray()));
}
Also used : MutableCharList(org.eclipse.collections.api.list.primitive.MutableCharList)

Example 3 with MutableCharList

use of org.eclipse.collections.api.list.primitive.MutableCharList in project eclipse-collections by eclipse.

the class ArrayListIterateTest method collectCharWithTargetOverOptimizeLimit.

@Test
public void collectCharWithTargetOverOptimizeLimit() {
    ArrayList<Integer> list = new ArrayList<>(Interval.zeroTo(OVER_OPTIMIZED_LIMIT));
    MutableCharList target = new CharArrayList();
    MutableCharList actual = ArrayListIterate.collectChar(list, PrimitiveFunctions.unboxIntegerToChar(), target);
    CharArrayList expected = new CharArrayList(list.size());
    for (int i = 0; i <= OVER_OPTIMIZED_LIMIT; i++) {
        expected.add((char) i);
    }
    Assert.assertEquals(expected, actual);
    Assert.assertSame("Target sent as parameter was not returned as result", target, 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 4 with MutableCharList

use of org.eclipse.collections.api.list.primitive.MutableCharList in project eclipse-collections by eclipse.

the class ArrayListIterateTest method collectChar.

@Test
public void collectChar() {
    ArrayList<Integer> list = this.createIntegerList();
    MutableCharList actual = ArrayListIterate.collectChar(list, PrimitiveFunctions.unboxIntegerToChar());
    Assert.assertEquals(CharArrayList.newListWith((char) -1, (char) 0, (char) 4), actual);
}
Also used : MutableCharList(org.eclipse.collections.api.list.primitive.MutableCharList) Test(org.junit.Test)

Example 5 with MutableCharList

use of org.eclipse.collections.api.list.primitive.MutableCharList in project eclipse-collections by eclipse.

the class ArrayListIterateTest method collectCharWithTarget.

@Test
public void collectCharWithTarget() {
    ArrayList<Integer> list = this.createIntegerList();
    MutableCharList target = new CharArrayList();
    MutableCharList actual = ArrayListIterate.collectChar(list, PrimitiveFunctions.unboxIntegerToChar(), target);
    Assert.assertSame("Target list sent as parameter not returned", target, actual);
    Assert.assertEquals(CharArrayList.newListWith((char) -1, (char) 0, (char) 4), actual);
}
Also used : MutableCharList(org.eclipse.collections.api.list.primitive.MutableCharList) CharArrayList(org.eclipse.collections.impl.list.mutable.primitive.CharArrayList) Test(org.junit.Test)

Aggregations

MutableCharList (org.eclipse.collections.api.list.primitive.MutableCharList)8 Test (org.junit.Test)4 CharArrayList (org.eclipse.collections.impl.list.mutable.primitive.CharArrayList)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 CharIterable (org.eclipse.collections.api.CharIterable)1 LazyCharIterable (org.eclipse.collections.api.LazyCharIterable)1 CharIterator (org.eclipse.collections.api.iterator.CharIterator)1 ReverseCharIterable (org.eclipse.collections.impl.lazy.primitive.ReverseCharIterable)1 AbstractCharIterable (org.eclipse.collections.impl.primitive.AbstractCharIterable)1