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:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>, java.util.RandomAccess

public class HashList<E>
extends java.util.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  java.util.HashSet<E> set
           
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
HashList()
           
HashList(java.util.Collection<? extends E> c)
           
HashList(int initialCapacity)
           
 
Method Summary
 boolean add(E o)
           
 void add(int index, E element)
           
 boolean addAll(java.util.Collection<? extends E> c)
           
 boolean addAll(int index, java.util.Collection<? extends E> c)
           
 void clear()
           
 java.lang.Object clone()
           
 boolean contains(java.lang.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 java.util.HashSet<E> set
Constructor Detail

HashList

public HashList()

HashList

public HashList(java.util.Collection<? extends E> c)

HashList

public HashList(int initialCapacity)
Method Detail

set

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

add

public boolean add(E o)
Specified by:
add in interface java.util.Collection<E>
Specified by:
add in interface java.util.List<E>
Overrides:
add in class java.util.ArrayList<E>

add

public void add(int index,
                E element)
Specified by:
add in interface java.util.List<E>
Overrides:
add in class java.util.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 java.util.List<E>
Overrides:
remove in class java.util.ArrayList<E>

clear

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

addAll

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

addAll

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

removeRange

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

contains

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

clone

public java.lang.Object clone()
Overrides:
clone in class java.util.ArrayList<E>


Copyright © 2004-2010 CodeLutin. All Rights Reserved.