How to use SortedMap interface in Java?

前端 未结 6 626
谎友^
谎友^ 2020-12-01 02:03

I have a

 Map

What is the best way to keep the map sorted according to the float?

Is SortedMap

6条回答
  •  一个人的身影
    2020-12-01 02:16

    TreeMap, which is an implementation of the SortedMap interface, would work.

    How do I use it ?

    Map map = new TreeMap();
    

提交回复
热议问题