开发者

How to store 2D Array coordinates in a list in java

Question is kind of hard to ask. I'll try my best to explain it.

I have a 2D array that is a grid. This grid has its co开发者_高级运维ntents filled with 0 and 1.

I want to store in a list the coordinates of the array that only have 0. How would you do that?

For example: the coordinate location 2, 3 has the value of 0. How should one go about storing the 2, 3?


Create a Point class that has coordinates (x,y) and the value 0 or 1. Store a List<Point> and you're all set.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜