1 / 8

Java Collections

Java Collections. Java Collections. Collections , Iterators , Algorithms. List. List interface A sequence of elements accessed by index g et(index), set(index, value) ArrayList (resizable array implementation) LinkedList (doubly-linked list implementation). Set. Set interface

nasia
Download Presentation

Java Collections

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Java Collections

  2. Java Collections • Collections, Iterators, Algorithms

  3. List • List interface • A sequence of elements accessed by index get(index), set(index, value) • ArrayList (resizable array implementation) • LinkedList (doubly-linked list implementation)

  4. Set • Set interface • A collection that contains no duplicates add(value), contains(value), remove(value) • HashSet (hash table implementation) • TreeSet (bst implementation) • LinkedHashSet (hash table + linked list impl)

  5. Queue • Queue interface • A collection designed for holding elements prior to processing add(value), peek(), remove() • ArrayDeque (fifo, resizable array impl) • LinkedList (fifo, linked list implementation) • PriorityQueue (priority queue, binary heap impl)

  6. Deque • Deque interface • A queue that supports efficient insertion and removal at both ends addFirst(value), addLast(value), peekFirst(), peekLast(), removeFirst(), removeLast() • ArrayDeque (resizable array implementation) • LinkedList (linked list implementation)

  7. Stack • Java’s Stack class is deprecated • If you need a stack, use a Deque push() => Deque.addFirst() pop() => Deque.removeFirst() peek() => Deque.peekFirst()

  8. Map • Map interface • A collection that maps keys to values • A set of (key, value) pairs where keys are unique put(key, value), get(key), contains(key), remove(key) keySet(), values(), entrySet() • HashMap (hash table implementation) • TreeMap (bst implementation) • LinkedHashMap (hash table + linked list impl)

More Related