public class PowerList<E> extends java.util.ArrayList<E> implements Dumpable
ArrayList
with some useful and frequently needed features. If a Comparator is
set, then this list will sort it's items using that Comparator. If the unique-flag is set, then
uniqueness is enforced, thus the same item cannot be added twice.Constructor and Description |
---|
PowerList() |
PowerList(boolean isUnique)
Creates a list that enforces uniqueness
|
PowerList(boolean isUnique,
java.util.Comparator<E> cmp) |
PowerList(java.util.Collection<E> c) |
PowerList(java.util.Comparator<E> cmp) |
PowerList(E[] array) |
PowerList(E[] array,
E oneMore) |
PowerList(E[] array,
E[] someMore) |
PowerList(int initialCapacity) |
PowerList(int initialCapacity,
boolean isUnique,
java.util.Comparator<E> cmp) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E o) |
boolean |
addAll(java.util.Collection<? extends E> c) |
boolean |
addAll(E... array) |
int |
addObject(E o)
Tells at what index the object has been inserted.
|
E |
getByName(java.lang.String key)
Returns the according object by name.
|
E |
getByName(java.lang.String key,
boolean ignoreCase)
Returns the according object by name.
|
java.util.Comparator<E> |
getComparator() |
E |
getFirst() |
E |
getLast() |
boolean |
isUnique()
Tells whether this list enforces uniqueness
|
boolean |
replace(E o)
Replaces the object if found in the list.
|
boolean |
replaceOrAdd(E o)
Replaces the object if found in the list
or adds it if it was not found.
|
boolean |
setAll(java.util.Collection<? extends E> c) |
boolean |
setAll(E... array) |
void |
setComparator(java.util.Comparator<E> cmp)
Creates a list that sorts it's item using the given comparator.
|
E[] |
toArray(java.lang.Class type) |
java.lang.String |
toDumpString()
Returns a multi-line String that shows the values (name=value) of all important
state variables of this object.
|
DumpString |
toDumpString(DumpString s)
This method allows subclasses to add values to the existing DumpString of the superclass.
|
java.lang.String |
toString()
Returns a single line String that shows the values of the most important
state variables of this object.
|
ToString |
toString(ToString s)
This method allows subclasses to add values to the existing ToString of the superclass.
|
java.lang.String |
toStringList() |
java.lang.String |
toStringList(java.lang.String separator) |
add, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeRange, retainAll, set, size, subList, toArray, toArray, trimToSize
public PowerList()
public PowerList(int initialCapacity)
public PowerList(boolean isUnique)
public PowerList(boolean isUnique, java.util.Comparator<E> cmp)
public PowerList(java.util.Comparator<E> cmp)
public PowerList(java.util.Collection<E> c)
public PowerList(E[] array)
public PowerList(int initialCapacity, boolean isUnique, java.util.Comparator<E> cmp)
public final void setComparator(java.util.Comparator<E> cmp)
GenericComparator
public final java.util.Comparator<E> getComparator()
public final boolean isUnique()
public final boolean setAll(E... array)
public final boolean addAll(E... array)
public final boolean setAll(java.util.Collection<? extends E> c)
public final boolean addAll(java.util.Collection<? extends E> c)
public final java.lang.String toStringList()
public final java.lang.String toStringList(java.lang.String separator)
public final E getByName(java.lang.String key)
public final E getByName(java.lang.String key, boolean ignoreCase)
public final E[] toArray(java.lang.Class type)
public final boolean add(E o)
public int addObject(E o)
public final boolean replace(E o)
public final boolean replaceOrAdd(E o)
public final E getLast()
public final E getFirst()
public final java.lang.String toDumpString()
Dumpable
toDumpString
in interface Dumpable
public DumpString toDumpString(DumpString s)
Dumpable
toDumpString
in interface Dumpable
public final java.lang.String toString()
Dumpable
Copyright © 2014 EsprIT-Systems. All Rights Reserved.