com.vaadin.data.util
Class ListSet<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<E>
              extended by 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 fast contains(Object) method. Each inserted object must by unique (as specified by AbstractList.equals(Object)). The set(int, Object) method allows duplicates because of the way Collections.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
ListSet()
           
ListSet(Collection<? extends E> c)
           
ListSet(int initialCapacity)
           
 
Method Summary
 boolean add(E e)
           
 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.
 boolean addAll(Collection<? extends E> c)
           
 boolean addAll(int index, Collection<? extends E> c)
           
 void clear()
           
 Object clone()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection<?> c)
           
 int indexOf(Object o)
           
 int lastIndexOf(Object o)
           
 E remove(int index)
           
 boolean remove(Object o)
           
protected  void removeRange(int fromIndex, int toIndex)
           
 E set(int index, E element)
           
 
Methods inherited from class java.util.ArrayList
ensureCapacity, get, isEmpty, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

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)
Specified by:
contains in interface Collection<E>
Specified by:
contains in interface List<E>
Overrides:
contains in class ArrayList<E>

containsAll

public boolean containsAll(Collection<?> c)
Specified by:
containsAll in interface Collection<E>
Specified by:
containsAll in interface List<E>
Overrides:
containsAll in class AbstractCollection<E>

add

public boolean add(E e)
Specified by:
add in interface Collection<E>
Specified by:
add in interface List<E>
Overrides:
add in class ArrayList<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.

Specified by:
add in interface List<E>
Overrides:
add in class ArrayList<E>

addAll

public boolean addAll(Collection<? extends E> c)
Specified by:
addAll in interface Collection<E>
Specified by:
addAll in interface List<E>
Overrides:
addAll in class ArrayList<E>

addAll

public boolean addAll(int index,
                      Collection<? extends E> c)
Specified by:
addAll in interface List<E>
Overrides:
addAll in class ArrayList<E>

clear

public void clear()
Specified by:
clear in interface Collection<E>
Specified by:
clear in interface List<E>
Overrides:
clear in class ArrayList<E>

indexOf

public int indexOf(Object o)
Specified by:
indexOf in interface List<E>
Overrides:
indexOf in class ArrayList<E>

lastIndexOf

public int lastIndexOf(Object o)
Specified by:
lastIndexOf in interface List<E>
Overrides:
lastIndexOf in class ArrayList<E>

remove

public E remove(int index)
Specified by:
remove in interface List<E>
Overrides:
remove in class ArrayList<E>

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<E>
Specified by:
remove in interface List<E>
Overrides:
remove in class ArrayList<E>

removeRange

protected void removeRange(int fromIndex,
                           int toIndex)
Overrides:
removeRange in class ArrayList<E>

set

public E set(int index,
             E element)
Specified by:
set in interface List<E>
Overrides:
set in class ArrayList<E>

clone

public Object clone()
Overrides:
clone in class ArrayList<E>


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.