作者:詹徐照
时间:2018年04月20日
转载请注明出处:https://www.jianshu.com/p/08bc1c63d3de
image.png
@startuml
interface Iterable {
+ Iterator<T> iterator();
+ void forEach(Consumer<? super T> action) // @since 1.8
+ Spliterator<T> spliterator();
}
interface Collection {
+ int size();
+ boolean isEmpty();
+ boolean containers(Object);
+ Object[] toArray();
+ T[] toArray(T[] a);
+ boolean add(E e);
+ boolean remote(Oject);
+ boolean containsAll(Collection<?> c);
+ boolean addAll(Collection<? extends E>;
+ boolean removeAll<Collection<?> c);
+ boolean removeIf(Predicate<? super E> filter); // @since 1.8
+ boolean retainAll(Collection<?> c);
+ void clear();
+ Stream<E> stream(); // @since 1.8
+ Stream<E> parallelStream(); // @since 1.8
}
abstract class AbstractCollection {
+ abstract Iterator<E> iterator();
+ abstract int size();
}
interface List {
+ boolean addAll(int index, Collection<? extends E> c);
+ void replaceAll(UnaryOperator<E> operator); // @since 1.8
+ void sort(Comparator<? super E> c); // @since 1.8
+ E get(int index);
+ E set(int index, E element);
+ void add(int index, E element);
+ E remove(int index);
+ int indexOf(Object o);
+ int lastIndexOf(Object o);
+ ListIterator<E> listIterator();
+ ListIterator<E> listIterator(int index);
+ List<E> subList(int fromIndex, int toIndex);
}
abstract class AbstractList {
# int modCount = 0
# void removeRange(int fromIndex, int toIndex);
+ abstract Object get(int index);
+ abstract int size();
}
class ArrayList {
+ ArrayList()
+ ArrayList(int initialCapacity)
+ ArrayList(Collection<? extends E> c)
+ trimToSize()
+ void ensureCapacity(int minCapacity)
}
Iterable <|-- Collection: extends
Collection <|-- List: extends
Collection <-- AbstractCollection : implements
AbstractCollection <|-- AbstractList: extends
List <-- AbstractList: implements
AbstractList <|-- ArrayList: extends
@enduml
未完待续...