import
java.util.SortedMap;
import
java.util.TreeMap;
public
class
SortedMapExample {
public
static
void
main(String[] args) {
SortedMap<String, Integer> sortedMap1 =
new
TreeMap<>();
sortedMap1.put(
"John"
,
30
);
sortedMap1.put(
"Alice"
,
25
);
sortedMap1.put(
"Bob"
,
40
);
SortedMap<String, Integer> sortedMap2 =
new
TreeMap<>();
sortedMap2.put(
"Alice"
,
25
);
sortedMap2.put(
"Bob"
,
40
);
sortedMap2.put(
"John"
,
30
);
boolean
areEqual = sortedMap1.equals(sortedMap2);
System.out.println(
"Are the two SortedMaps equal? "
+ areEqual);
}
}