Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any LinkedTreeMap implementation in java?

is there any LinkedTreeMap implementation available in standard JDK or simple standalone library that support both sorting and insertion order? I found gridsim that has a LinkedTreeMap implementation. But seems it is a big library.

[UPDATE]

I want a Map which sorts elements based on keys which is Integer in my case and also gives me two kinds of Iterator based on:

  1. sorted keys
  2. insertion order
like image 956
Majid Azimi Avatar asked Aug 21 '26 07:08

Majid Azimi


2 Answers

Can you see the LinkedTreeMap of google-gson library?

This preserve the insertion order.

like image 167
Paul Vargas Avatar answered Aug 22 '26 19:08

Paul Vargas


I also came across this free-standing library: http://tech.dolhub.com/Code/LinkedTree

However, note that the author states that the classes performance is not great compared with TreeMap.

like image 43
Stephen C Avatar answered Aug 22 '26 20:08

Stephen C