1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Java programming collections

21 162 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 21
Dung lượng 232 KB

Nội dung

Java Programming II Collections Java Programming II Contents Collections Framework  Collections of Objects  Iterable and Iterator  Comparable and Comparator  The Legacy Collection Types  Java Programming II Collections      Collections are holders that let you store and organize objects in useful ways for efficient access In the package java.util, there are interfaces and classes that provide a generic collection framework The Collections interfaces: Collection, Set, SortedSet, List, Queue, Map, SortedMap, Iterator, ListIterator, Iterable Some useful implementations of the interfaces: HashSet, TreeSet, ArrayList, LinkedList, HashMap, TreeMap, WeakHashMap Exception Convetions:      UnsupportedOperationException ClassCastException IllegalArgumentException NoSuchElementException NullPointerException Java Programming II Type Trees for Collections Set SortedSet Iterable Iterator Collection ListIerator Queue EnumSet List ArrayList PriorityQueue HashSet LinkedList TreeSet LinkedHashSet Map EnumMap WeakHashMap SortedMap HashMap TreeMap LinkedHashMap Java Programming II The Collection Interface  The Collection Interface    The basis of much of the collection system is the Collection interface   public boolean removeAll(Collection coll) public boolean retainAll(Collection coll) public void clear() Methods:           public int size() public boolean isEmpty() public boolean contains(Object elem) public Iterator iterator() public Object[] toArray() public T[] toArray(T[] dest) public boolean add(E elem) public boolean remove(Object elem) public boolean containsAll(Collection coll) public boolean addAll(Collection

Ngày đăng: 27/10/2017, 11:10