Wednesday, 9 September 2015

Java - differences between TreeSet and TreeMap



TreeSet
TreeMap
1.      TreeMap is an implementation of Map interface
 TreeSet is an implementation of Set interface
2.      TreeSet stores only one object.
 TreeMap uses two objects called key and Value.
3.      Objects in TreeSet are sorted
 Keys in TreeMap remain in sorted Order.
4.      Duplicate objects are not allowed in  TreeSet
 Duplicates values are allowed in TreeMap, but keys are  unique in nature

No comments:

Post a Comment