org.eclipse.emf.common.util
Class UniqueEList<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by org.eclipse.emf.common.util.BasicEList<E>
              extended by org.eclipse.emf.common.util.UniqueEList<E>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>, java.util.RandomAccess, EList<E>
Direct Known Subclasses:
UniqueEList.FastCompare

public class UniqueEList<E>
extends BasicEList<E>

A BasicEList that allows only unique elements.

See Also:
Serialized Form

Nested Class Summary
static class UniqueEList.FastCompare<E>
          A UniqueEList that uses == instead of equals to compare members.
 
Nested classes/interfaces inherited from class org.eclipse.emf.common.util.BasicEList
BasicEList.BasicIndexOutOfBoundsException, BasicEList.EIterator<E1>, BasicEList.EListIterator<E1>, BasicEList.NonResolvingEIterator<E1>, BasicEList.NonResolvingEListIterator<E1>, BasicEList.UnmodifiableEList<E>
 
Field Summary
 
Fields inherited from class org.eclipse.emf.common.util.BasicEList
data, size
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
UniqueEList()
          Creates an empty instance with no initial capacity.
UniqueEList(java.util.Collection<? extends E> collection)
          Creates an instance that is a copy of the collection, with duplicates removed.
UniqueEList(int initialCapacity)
          Creates an empty instance with the given capacity.
 
Method Summary
protected  boolean isUnique()
          Returns true because this list requires uniqueness.
 
Methods inherited from class org.eclipse.emf.common.util.BasicEList
add, add, addAll, addAll, addAllUnique, addAllUnique, addAllUnique, addAllUnique, addUnique, addUnique, assign, basicGet, basicIterator, basicList, basicListIterator, basicListIterator, canContainNull, clear, clone, contains, containsAll, data, didAdd, didChange, didClear, didMove, didRemove, didSet, equalObjects, equals, get, getDuplicates, getNonDuplicates, grow, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, move, move, newData, remove, remove, removeAll, resolve, retainAll, set, setData, setUnique, shrink, size, toArray, toArray, toString, useEquals, validate
 
Methods inherited from class java.util.AbstractList
removeRange, subList
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
subList
 

Constructor Detail

UniqueEList

public UniqueEList()
Creates an empty instance with no initial capacity.


UniqueEList

public UniqueEList(int initialCapacity)
Creates an empty instance with the given capacity.

Parameters:
initialCapacity - the initial capacity of the list before it must grow.
Throws:
java.lang.IllegalArgumentException - if the initialCapacity is negative.

UniqueEList

public UniqueEList(java.util.Collection<? extends E> collection)
Creates an instance that is a copy of the collection, with duplicates removed.

Parameters:
collection - the initial contents of the list.
Method Detail

isUnique

protected boolean isUnique()
Returns true because this list requires uniqueness.

Overrides:
isUnique in class BasicEList<E>
Returns:
true.

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.