Untitled

Anonymous
java
05/17/2023 12:12 PM
532 B
17
Indexable
public class Maps {
    public static void main(String[] args) {
        Map<String, Integer> map1, map2, map3;

        map1 = Map.of(
                "A", 0,
                "D", 1,
                "B", 2,
                "C", 3
        );

        map2 = new LinkedHashMap<>(map1);
        map3 = new TreeMap<>(map1);

        System.out.println(map2);
        System.out.println(map3);
    }
}
Editor is loading...