Java TreeMap Example in Java

Tutorials Shared by the Internet Community

Advertisements


Synopsis

TreeMap in Java is the best solution for Java programs which are looking for sorted datastrucutre. TreeMap in Java sort keys based on either their nat

Statistics

  • Total Hits - 27130

  • Total Votes - 99 votes

  • Vote Up - 43 votes

  • Vote Down - 56 votes

  • Domain - javarevisited.blogspot.com

  • Category - JAVA/Collections

  • Submitted By - Javin Paul

  • Submitted on - 2011-12-18 13:57:25

Description

TreeMap in Java is the best solution for Java programs which are looking for sorted data strucutre. TreeMap in Java sort keys based on either their
natural order or any custom order defined by provided comparator while creating TreeMap. If you try to store any element in TreeMap which is not
of same type like earlier key you will get ClassCastException because with every new key insertion treeMap sort all the keys. ...


Site  |   Broken  |   Tweet  |   Facebook  |     |   Save  |   Liked  |   Down

Advertisements