Data Structure

Collection

A collection is an object that contains many elements. You can put duplicate elements to some collections. And some collections have ordered elements.

Java Collections Framework Tutorial

Collection Interfaces

  • java.util.Set

  • java.util.List

  • java.util.Queue

  • java.util.Deque

  • java.util.Map

interface hash table array balanced tree linked list hash + linked
Set HashSet ArraySet TreeSet LinkedHashSet
List ArrayList LinkedList
Map HashMap ArrayMap TreeMap LinkedHashMap
class ordered sorted duplicate values null keys null elements
HashSet X X X O
ArraySet O X X O
TreeSet X O X X
LinkedHashSet O X X O
ArrayList O X O O
LinkedList O X O O
HashMap X X O O O
ArrayMap X X O O O
TreeMap X O O X O
LinkedHashMap O X O O O

Concurrent Collections

  • ConcurrentHashMapis normally preferable to a synchronizedHashMap
  • ConcurrentSkipListMapis normally preferable to a synchronizedTreeMap
  • CopyOnWriteArrayListis preferable to a synchronizedArrayList

java.util.concurrent of Android Developer

results matching ""

    No results matching ""