org.nuiton.util
Class HashList<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<E>
              extended by org.nuiton.util.HashList<E>
All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, List<E>, RandomAccess

public class HashList<E>
extends ArrayList<E>

Cette objet permet de gerer l'unicité des objets ajouté. Lorsque l'on appelle la methode add sur cette objet, il verifie en premier que l'objet n'est pas deja dans la liste. S'il y est alors il n'est pas ajouter, sinon il est ajouter. L'utilisation de la methode set n'est pas permise

FIXME: la serialisation n'est pas modifier, c-a-d que seul le tableau est conserve et pas la hashSet, donc apres recuperation, l'uticite n'est plus garantie. Il faut donc surcharger readObject et writeObject pour conserver le HashSet

See Also:
Serialized Form

Field Summary
protected  HashSet<E> set
           
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
HashList()
           
HashList(Collection<? extends E> c)
           
HashList(int initialCapacity)
           
 
Method Summary
 boolean add(E o)
           
 void add(int index, E element)
           
 boolean addAll(Collection<? extends E> c)
           
 boolean addAll(int index, Collection<? extends E> c)
           
 void clear()
           
 Object clone()
           
 boolean contains(Object elem)
           
 E remove(int index)
          supprime l'element demandé.
protected  void removeRange(int fromIndex, int toIndex)
           
 E set(int index, E element)
           
 
Methods inherited from class java.util.ArrayList
ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Field Detail

set

protected HashSet<E> set
Constructor Detail

HashList

public HashList()

HashList

public HashList(Collection<? extends E> c)

HashList

public HashList(int initialCapacity)
Method Detail

set

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

add

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

remove

public E remove(int index)
supprime l'element demandé. Si l'elment n'existe pas alors, null est retrouné.

Specified by:
remove in interface List<E>
Overrides:
remove 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>

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>

removeRange

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

contains

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

clone

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


Copyright © 2004-2010 CodeLutin. All Rights Reserved.