public interface Iterable<E> { Iterator<E> iterator(); }I.7.b) Collection
public interface Collection<E> extends Iterable<E> { boolean contains(Object element); boolean containsAll(Collection<?> c); boolean isEmpty(); int size(); Object[] toArray(); <T> T[] toArray(T[] a); boolean add(E element); //optional boolean addAll(Collection<? extends E> c); //optional void clear(); //optional boolean remove(Object element); //optional boolean removeAll(Collection<?> c); //optional boolean retainAll(Collection<?> c); //optional }I.7.c) List
public interface List<E> extends Collection<E> { E get(int index); int indexOf(Object o); int lastIndexOf(Object o); ListIterator<E> listIterator(); ListIterator<E> listIterator(int index); List<E> subList(int from, int to); void add(int index, E element); //optional boolean addAll(int index, Collection<? extends E> c); //optional E remove(int index); //optional E set(int index, E element); //optional }
public abstract class AbstractCollection<E> implements Collection<E> { // Iterable : abstract Iterator<E> iterator(); // Collection : abstract int size(); boolean contains(Object element) //implemented boolean containsAll(Collection<?> c) //implemented boolean isEmpty() //implemented Object[] toArray() //implemented <T> T[] toArray(T[] a) //implemented boolean addAll(Collection<? extends E> c) //implemented/unsupported void clear() //implemented/unsupported boolean removeAll(Collection<?> c) //implemented/unsupported boolean retainAll(Collection<?> c) //implemented/unsupported boolean add(E element) //unsupported boolean remove(Object element) //unsupported // Object : @Override String toString() //implemented }I.8.b) AbstractList
public abstract class AbstractList<E> extends AbstractCollection<E> implements List<E> { // Iterable : Iterator<E> iterator() //implemented // Collection : void add(E element) //unsupported void clear() //unsupported // List : abstract E get(int index); int indexOf(Object o) //implemented int lastIndexOf(Object o) //implemented ListIterator<E> listIterator() //implemented ListIterator<E> listIterator(int index) //implemented List<E> subList(int from, int to) //implemented boolean addAll(int index, Collection<? extends E> c) //implemented/unsupported void add(int index, E element) //unsupported E remove(int index) //unsupported E set(int index, E element) //unsupported // Object : @Override boolean equals(Object o) //implemented }
public class ArrayList<E> extends AbstractList<E> implements List<E> { // AbstractCollection : int size() @Override boolean addAll(Collection<? extends E> c) @Override boolean contains(Object o) @Override boolean isEmpty() @Override boolean remove(Object o) @Override Object[] toArray() @Override <T> T[] toArray(T[] a) // AbstractList : @Override boolean add(E e) @Override boolean addAll(int index, Collection<? extends E> c) @Override int indexOf(Object o) @Override int lastIndexOf(Object o) @Override ListIterator<E> listIterator() @Override ListIterator<E> listIterator(int index) @Override E set(int index, E element) @Override List<E> subList(int fromIndex, int toIndex) // List : void clear() E get(int index) void add(int index, E element) E remove(int index) // ArrayList : void ensureCapacity(int minCapacity) void trimToSize() }I.9.b) Stack
public class Stack<E> extends Vector<E> { boolean empty() E peek() E pop() E push(E item) int search(Object o) }
public interface Map<K,V> { // Basic operations V put(K key, V value); V get(Object key); V remove(Object key); boolean containsKey(Object key); boolean containsValue(Object value); int size(); boolean isEmpty(); // Bulk operations void putAll(Map<? extends K, ? extends V> m); void clear(); // Collection Views public Set<K> keySet(); public Collection<V> values(); }I.11.b) AbstractMap
Dernière mise à jour :