public class OrderedSet<E>
extends java.lang.Object
implements java.util.Set<E>, java.util.List<E>
Modifier | Constructor and Description |
---|---|
|
OrderedSet()
Initialize the new instance with default values.
|
|
OrderedSet(int initialCapacity)
Initialize the new set with an initial capacity.
|
protected |
OrderedSet(java.util.List<E> innerList)
Initialize the new set with an inner list.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(E obj) |
void |
add(int index,
E element)
Inserts the specified element at the specified position in this list
|
boolean |
addAll(java.util.Collection<? extends E> coll) |
boolean |
addAll(int index,
java.util.Collection<? extends E> c)
Inserts all of the elements in the specified collection into this list
at the specified position if they are not yet in this list.
|
void |
clear() |
boolean |
contains(java.lang.Object obj) |
boolean |
containsAll(java.util.Collection<?> coll) |
protected java.util.List<E> |
createInnerList(int initialCapacity) |
E |
get(int index)
Returns the element at the specified position in this list.
|
protected java.util.List<E> |
getElements() |
int |
indexOf(java.lang.Object object)
Returns the index in this list of the first occurrence of the specified
element, or -1 if this list does not contain this element.
|
boolean |
isEmpty() |
java.util.Iterator<E> |
iterator() |
int |
lastIndexOf(java.lang.Object object)
Returns the index in this list of the last occurrence of the specified
element, or -1 if this list does not contain this element.
|
java.util.ListIterator<E> |
listIterator()
Returns a list iterator of the elements in this list (in proper sequence).
|
java.util.ListIterator<E> |
listIterator(int index)
Returns a list iterator of the elements in this list (in proper sequence),
starting at the specified position in this list.
|
E |
remove(int index)
Returns the object at the specified index
|
boolean |
remove(java.lang.Object obj) |
boolean |
removeAll(java.util.Collection<?> coll) |
boolean |
retainAll(java.util.Collection<?> coll) |
E |
set(int index,
E element)
Sets the given element at the specified index if the element is not
yet already in the collection!
|
protected void |
setElements(java.util.List<E> newValue) |
int |
size() |
java.util.List<E> |
subList(int fromIndex,
int toIndex)
Returns a sub list containing the elements in the range of the defined
indices.
|
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] array) |
public OrderedSet()
public OrderedSet(int initialCapacity)
protected OrderedSet(java.util.List<E> innerList)
public boolean add(E obj)
public boolean addAll(java.util.Collection<? extends E> coll)
public void clear()
public boolean contains(java.lang.Object obj)
public boolean containsAll(java.util.Collection<?> coll)
public boolean isEmpty()
public java.util.Iterator<E> iterator()
public boolean remove(java.lang.Object obj)
public boolean removeAll(java.util.Collection<?> coll)
public boolean retainAll(java.util.Collection<?> coll)
public int size()
public java.lang.Object[] toArray()
public <T> T[] toArray(T[] array)
public void add(int index, E element)
add
in interface java.util.List<E>
public boolean addAll(int index, java.util.Collection<? extends E> c)
addAll
in interface java.util.List<E>
public E get(int index)
get
in interface java.util.List<E>
public int indexOf(java.lang.Object object)
indexOf
in interface java.util.List<E>
public int lastIndexOf(java.lang.Object object)
lastIndexOf
in interface java.util.List<E>
public java.util.ListIterator<E> listIterator()
listIterator
in interface java.util.List<E>
public java.util.ListIterator<E> listIterator(int index)
listIterator
in interface java.util.List<E>
public E remove(int index)
remove
in interface java.util.List<E>
public E set(int index, E element)
set
in interface java.util.List<E>
public java.util.List<E> subList(int fromIndex, int toIndex)
subList
in interface java.util.List<E>
protected java.util.List<E> createInnerList(int initialCapacity)
protected java.util.List<E> getElements()
protected void setElements(java.util.List<E> newValue)