public class ListBuilder<T> extends AbstractList<T> implements RandomAccess, Serializable
A simple array based List that support append element to the tail of the list only.
Notes:
modCount| Constructor and Description |
|---|
ListBuilder(int initialCapacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
T element) |
boolean |
add(T t) |
boolean |
addAll(Collection<? extends T> c) |
boolean |
addAll(int index,
Collection<? extends T> c) |
boolean |
addAll(int index,
ListBuilder<? extends T> c) |
boolean |
addAll(ListBuilder<? extends T> c) |
ListBuilder<T> |
append(Collection<? extends T> col) |
ListBuilder<T> |
append(Collection<? extends T> c1,
Collection<? extends T> c2) |
ListBuilder<T> |
append(Collection<? extends T> c1,
Collection<? extends T> c2,
Collection<? extends T>... ca) |
ListBuilder<T> |
append(Enumeration<? extends T> enumeration) |
ListBuilder<T> |
append(Iterable<? extends T> iterable) |
ListBuilder<T> |
append(Iterator<? extends T> iterator) |
ListBuilder<T> |
append(Object[] ta) |
ListBuilder<T> |
append(Object[] ta1,
Object[] ta2) |
ListBuilder<T> |
append(Object[] ta1,
Object[] ta2,
Object[]... taa) |
ListBuilder<T> |
append(T t) |
ListBuilder<T> |
append(T t1,
T t2) |
ListBuilder<T> |
append(T t1,
T t2,
T t3) |
ListBuilder<T> |
append(T t1,
T t2,
T t3,
T t4) |
ListBuilder<T> |
append(T t1,
T t2,
T t3,
T t4,
T t5) |
ListBuilder<T> |
append(T t1,
T t2,
T t3,
T t4,
T t5,
T... ta) |
protected void |
checkState() |
void |
clear() |
static <T> ListBuilder<T> |
create()
Create an empty ListBuilder instance
|
static <T> ListBuilder<T> |
create(int initialCapacity) |
T |
get(int index) |
int |
size() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
C.List<T> |
toList()
Return an immutable list contains all element of this list builder and then release references to the internal buffer.
|
static <T> C.List<T> |
toList(Collection<? extends T> col)
Returns an immutable
C.List from a collection |
static <T> C.List<T> |
toList(Enumeration<? extends T> enumeration) |
static <T> C.List<T> |
toList(Iterable<? extends T> iterable)
Returns an immutable
C.List from iterable |
static <T> C.List<T> |
toList(Iterator<? extends T> iterator)
Returns an immutable
C.List from an iterator |
C.Set<T> |
toSet() |
protected void |
trimToSize() |
equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListcontains, containsAll, isEmpty, remove, removeAll, retainAll, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitcontains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliteratorparallelStream, removeIf, streamprotected void checkState()
protected void trimToSize()
public int size()
size in interface Collection<T>size in interface List<T>size in class AbstractCollection<T>public T get(int index)
public boolean add(T t)
add in interface Collection<T>add in interface List<T>add in class AbstractList<T>public void add(int index,
T element)
public Object[] toArray()
toArray in interface Collection<T>toArray in interface List<T>toArray in class AbstractCollection<T>public <T> T[] toArray(T[] a)
toArray in interface Collection<T>toArray in interface List<T>toArray in class AbstractCollection<T>public boolean addAll(Collection<? extends T> c)
addAll in interface Collection<T>addAll in interface List<T>addAll in class AbstractCollection<T>public boolean addAll(ListBuilder<? extends T> c)
public boolean addAll(int index,
ListBuilder<? extends T> c)
public boolean addAll(int index,
Collection<? extends T> c)
public void clear()
clear in interface Collection<T>clear in interface List<T>clear in class AbstractList<T>public ListBuilder<T> append(T t)
public ListBuilder<T> append(Object[] ta)
public ListBuilder<T> append(Object[] ta1, Object[] ta2)
public ListBuilder<T> append(Object[] ta1, Object[] ta2, Object[]... taa)
public ListBuilder<T> append(T t1, T t2)
public ListBuilder<T> append(T t1, T t2, T t3)
public ListBuilder<T> append(Collection<? extends T> col)
public ListBuilder<T> append(Collection<? extends T> c1, Collection<? extends T> c2)
public ListBuilder<T> append(Collection<? extends T> c1, Collection<? extends T> c2, Collection<? extends T>... ca)
public ListBuilder<T> append(Iterable<? extends T> iterable)
public ListBuilder<T> append(Iterator<? extends T> iterator)
public ListBuilder<T> append(Enumeration<? extends T> enumeration)
public C.List<T> toList()
Return an immutable list contains all element of this list builder and then release references to the internal buffer. The list builder is obsolete after calling this method, and calling other building method thereafter will trigger IllegalStateException
public static <T> C.List<T> toList(Iterable<? extends T> iterable)
Returns an immutable C.List from iterable
T - the element typeiterable - the iterablepublic static <T> C.List<T> toList(Iterator<? extends T> iterator)
Returns an immutable C.List from an iterator
T - the element typeiterator - the iteratorpublic static <T> C.List<T> toList(Enumeration<? extends T> enumeration)
public static <T> C.List<T> toList(Collection<? extends T> col)
Returns an immutable C.List from a collection
T - element typecol - the collection specifiedpublic static <T> ListBuilder<T> create()
Create an empty ListBuilder instance
T - the type of the element in the builderpublic static <T> ListBuilder<T> create(int initialCapacity)
Copyright © 2014–2019 OSGL (Open Source General Library). All rights reserved.