Package com.vaadin.data.util
Class ListSet<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<E>
-
- com.vaadin.data.util.ListSet<E>
-
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<E>,Collection<E>,List<E>,RandomAccess
public class ListSet<E> extends ArrayList<E>
ListSet is an internal Vaadin class which implements a combination of a List and a Set. The main purpose of this class is to provide a list with a fastcontains(Object)method. Each inserted object must by unique (as specified byAbstractList.equals(Object)). Theset(int, Object)method allows duplicates because of the wayCollections.sort(java.util.List)works. This class is subject to change and should not be used outside Vaadin core.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description ListSet()ListSet(int initialCapacity)ListSet(Collection<? extends E> c)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, E element)Works as java.util.ArrayList#add(int, java.lang.Object) but returns immediately if the element is already in the ListSet.booleanadd(E e)booleanaddAll(int index, Collection<? extends E> c)booleanaddAll(Collection<? extends E> c)voidclear()Objectclone()booleancontains(Object o)booleancontainsAll(Collection<?> c)intindexOf(Object o)intlastIndexOf(Object o)Eremove(int index)booleanremove(Object o)protected voidremoveRange(int fromIndex, int toIndex)Eset(int index, E element)-
Methods inherited from class java.util.ArrayList
ensureCapacity, forEach, get, isEmpty, iterator, listIterator, listIterator, removeAll, removeIf, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
Methods inherited from class java.util.AbstractList
equals, hashCode
-
Methods inherited from class java.util.AbstractCollection
toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, stream
-
-
-
-
Constructor Detail
-
ListSet
public ListSet()
-
ListSet
public ListSet(Collection<? extends E> c)
-
ListSet
public ListSet(int initialCapacity)
-
-
Method Detail
-
contains
public boolean contains(Object o)
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceList<E>- Overrides:
containsAllin classAbstractCollection<E>
-
add
public boolean add(E e)
-
add
public void add(int index, E element)Works as java.util.ArrayList#add(int, java.lang.Object) but returns immediately if the element is already in the ListSet.
-
addAll
public boolean addAll(Collection<? extends E> c)
-
addAll
public boolean addAll(int index, Collection<? extends E> c)
-
clear
public void clear()
-
indexOf
public int indexOf(Object o)
-
lastIndexOf
public int lastIndexOf(Object o)
- Specified by:
lastIndexOfin interfaceList<E>- Overrides:
lastIndexOfin classArrayList<E>
-
remove
public E remove(int index)
-
remove
public boolean remove(Object o)
-
removeRange
protected void removeRange(int fromIndex, int toIndex)- Overrides:
removeRangein classArrayList<E>
-
-