Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which of these statements about what LinkedHashMap adds to HashMap is correct?

  • A.Sorting of the keys by their natural ordering.
  • B.Synchronized access.
  • C.Rejection of null keys.
  • D.A predictable iteration order.

Answer: D

It keeps a linked list through the entries, so iteration order is defined rather than arbitrary; constructed in access order it also underpins a simple LRU cache. Sorting belongs to TreeMap, and it is no more synchronized than HashMap.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.