Java Collection FrameWork series - TreeMap in Java- Internal Working of TreeMap

preview_player
Показать описание
You can learn Java with me as the Java Programming language is being made easily. It would take a period of minimum three months and maximum 6 months to master Java. I would recommend you to watch all my videos to crack any software interviews that would require Java Programming language as a primary skill.

TreeMap:-
========
1. It is an implementation class for NavigableMap,SortedMap and Map interfaces.
2. It was introduced in JDK1.2 version.
3. It is a non-Legacy class.
4. It is going to store the data in the form of "Key":"Value" pair.
5. Please be informed that the keys are unique and the values can be duplicated.
6. By default, TreeMap does not follow insertion order with respect to keys.
7. By default, TreeMap follows sorting order with respect to keys
9. By default, TreeMap does not allow null key. And, if you add any null key, you will get
Please be informed that you are allowed to add the null value.
10. By default, TreeMap always allow comparable objects in the key.
11. TreeMap internal Data Structure is "Red-Black Tree"
12. It is non-Synchronized in nature.
13. It follows parallel execution.
14. It is not thread safe.
15. Its performance is high.
16. There will be no data consistency.
Constructors in TreeMap:-
=====================
1. public TreeMap();
2. public TreeMap(Map m);
3. public TreeMap(SortedMap sm);

Methods:-
=========
1. public Object firstKey();
2. public Object lastKey();
3. public SortedMap headMap(Object key);
4. public SortedMap tailMap(Object key);
5. public SortedMap submap(Object fromKey , Object tokey);
6. public NavigableMap descendingMap();
7. public Object ceilingKey(Object Key);
8. public Object higherKey(Object Key);
9. public Object floorKey(Object Key);
10. public Object lowerKey(Object Key);
11. public Object pollFirstEntry();
12. public Object pollLastEntry();
Рекомендации по теме