// identique à ce qui est dans le package WattBrown; // Version générique juin 2010 // modifications en novembre 2010 pour rendre la signature de certaines méthodes // plus compatibles avec celles équivalentes dans java.util.List import java.util.Iterator; public interface List extends Iterable { // Each List value is a list (sequence) whose elements are objects. // Accessors ... public boolean isEmpty (); // Return true if and only if this list is empty. public int size (); // Return this list's length. public E get (int i); // Return the element with index i in this list, // or null if there is no such element. public boolean contains(E x); // Returns true if this list contains the specified element. public int indexOf(E x); // Returns the index of the first occurrence of the specified element // in this list, or -1 if this list does not contain the element. // Transformers ... public void clear (); // Make this list empty. public E set (int i, E x); // Replace by x the element at index i in this list, // or do nothing if there is no such element. public boolean add (E x); // Add x after the last element of this list. public boolean add (int i, E x); // Add x as the element with index i in this list, // or do nothing if there can be no such element. public boolean addAll (List that); // Add all the elements of that list after the last element // of this list. public E remove (int i); // Remove and return the element with index i in this list, // or return null if there is no such element. // Iterator ... public Iterator iterator (); // Return an iterator that visits all elements of this list, // in sequence from first to last. }