Monday, 25 April 2016

Choosing the right Map


HashMap vs. TreeMap vs. LinkedHashMap

All maintains key / value pair

FASTEST
HashMap , but no order maintained

MORE INSERT/DELETE
HashMap , but no order maintained

TO MAINTAIN INSERTION ORDER
LinkedHashMap

TO MAINTAIN ORDER BY KEYS
TreeMap

No comments:

Post a Comment

Note: only a member of this blog may post a comment.