Skip to content

PrimitiveList

landawn edited this page Apr 29, 2018 · 1 revision

PrimitiveList implements the functions in List for primitive types: BooleanList, CharList, ByteList, ShortList, IntList, LongList, FloatList, DoubleList and ObjectList. It's first time for developers to keep efficiency of primitive types while obtain the flexibility provided by Object/Collection/Stream. It becomes incredible easy/convenient to program with primitive array/list or convert among different types. Additionally, Stream/Lambda are fully supported for primitive types. Here is a simple sample:

@Test
public void test_CharList() {
    CharList charList = CharList.of('1', '2', '3', 'a', 'b', 'c');
    assertTrue(charList.contains('b'));

    charList.remove('b');
    assertFalse(charList.contains('b'));

    CharList letters = charList.filter(e -> e >= 'a');
    assertEquals(2, letters.size());
}