while using TreeMap and HashMap,find out that they are different
first TreeMap is sorted by key in nature,notice that if you put as key as negative number and it is save as String,then,it will mass up
you can put key as Long(negative),then it will work,HashMap is not sorted,but it will not keep the order that you put then in.
solution is to switch key and value,if they are both unique.
HashTable is older HashMap is new
HashTable is not allow null values.HashMap allows.
HashTable is synchnozed,HashMap is not.
No comments:
Post a Comment