Create Map in Java

后端 未结 5 1216
小鲜肉
小鲜肉 2020-12-13 12:06

I\'d like to create a map that contains entries consisting of (int, Point2D)

How can I do this in Java?

I tried the following unsuc

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-13 12:15

    Java 9

    public static void main(String[] args) {
        Map map = Map.ofEntries(entry(1,"A"), entry(2,"B"), entry(3,"C"));
    }
    

提交回复
热议问题