Home / Java Programming / Objects and Collections :: Discussion

Discussion :: Objects and Collections

  1. Which collection class allows you to access its elements by associating a key with an element's value, and provides synchronization?

  2. A.
    java.util.SortedMap
    B.
    java.util.TreeMap
    C.
    java.util.TreeSet
    D.
    java.util.Hashtable

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    Hashtable is the only class listed that provides synchronized methods. If you need synchronization great; otherwise, use HashMap, it's faster.


Be The First To Comment