T
- The entry type.public final class AList<T> extends ArrayList<T>
ArrayList
.
Provides various convenience methods for creating and populating a list with minimal code.
modCount
Constructor and Description |
---|
AList()
Constructor.
|
AList(Collection<T> c)
Copy constructor.
|
AList(int capacity)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
AList<T> |
a(T... t)
Add.
|
AList<T> |
a(T t)
Add.
|
AList<T> |
aa(Collection<? extends T> c)
Add all.
|
AList<T> |
aif(boolean b,
T val)
Add if.
|
AList<T> |
aifnn(T... t)
Add if not null.
|
AList<T> |
arev(List<? extends T> c)
Add reverse.
|
AList<T> |
arev(T[] c)
Add reverse.
|
<T2> T2[] |
asArrayOf(Class<T2> c)
Convert the contents of this list into a new array.
|
String |
asString()
Convert to Simplified JSON.
|
String |
asString(WriterSerializer ws)
Convert to a string using the specified serializer.
|
static <T> AList<T> |
nullable(Collection<T> c)
Creates a copy of the collection if it's not
|
static <T> AList<T> |
of()
Convenience method for creating an empty list of objects.
|
static <T> AList<T> |
of(Collection<T> c)
Convenience method for creating a list of objects.
|
static <T> AList<T> |
of(T... t)
Convenience method for creating a list of objects.
|
static <T> AList<T> |
ofa(T... t)
Convenience method for creating a list of objects.
|
Iterable<T> |
riterable()
Returns a reverse iterable over this list.
|
String |
toString()
Convert to Simplified JSON.
|
List<T> |
unmodifiable()
Returns an unmodifiable view of this list.
|
static <T> List<T> |
unmodifiable(Collection<T> c)
Convenience method for creating an unmodifiable list out of the specified collection.
|
static <T> List<T> |
unmodifiable(T... t)
Convenience method for creating an unmodifiable list of objects.
|
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
equals, hashCode
containsAll
finalize, getClass, notify, notifyAll, wait, wait, wait
containsAll, equals, hashCode
parallelStream, stream
public AList()
Creates an array list of default size.
public AList(int capacity)
Creates an array list of default size.
capacity
- Initial capacity.public AList(Collection<T> c)
c
- Initial contents. Can be public static <T> AList<T> of()
Creates an array list of default size.
@SafeVarargs public static <T> AList<T> of(T... t)
t
- The initial values.public static <T> AList<T> ofa(T... t)
Identical to of(Object...)
but allows you to distinguish from of(Collection)
when creating
multi-dimensional lists.
t
- The initial values.public static <T> AList<T> of(Collection<T> c)
Creates a list with the same capacity as the array.
c
- The initial values.public static <T> AList<T> nullable(Collection<T> c)
c
- The initial values.public static <T> List<T> unmodifiable(T... t)
Creates a list with the same capacity as the array.
t
- The initial values.public static <T> List<T> unmodifiable(Collection<T> c)
T
- The element type.c
- The collection to add.public AList<T> a(T t)
Adds an entry to this list.
t
- The entry to add to this list.public AList<T> a(T... t)
Adds multiple entries to this list.
t
- The entries to add to this list.public AList<T> aa(Collection<? extends T> c)
Adds all the entries in the specified collection to this list.
c
- The collection to add to this list. Can be public AList<T> aif(boolean b, T val)
Adds an entry to this list if the boolean flag is
b
- The boolean flag.val
- The value to add.public AList<T> aifnn(T... t)
Adds entries to this list skipping
t
- The objects to add to the list.public AList<T> arev(List<? extends T> c)
Adds all the entries in the specified collection to this list in reverse order.
c
- The collection to add to this list.public AList<T> arev(T[] c)
Adds the contents of the array to the list in reverse order.
i.e. add values from the array from end-to-start order to the end of the list.
c
- The collection to add to this list.public List<T> unmodifiable()
public <T2> T2[] asArrayOf(Class<T2> c)
c
- The component type of the array.public Iterable<T> riterable()
public String asString(WriterSerializer ws)
ws
- The serializer to use to serialize this collection.public String asString()
public String toString()
toString
in class AbstractCollection<T>
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.