i am making a game and it uses a gird i can implement it by extending arraylist for example:
public class Grid extends ArrayList<ArrayList<obj>>
{
public void addObj(Obj obj ,int x, int y)
{
get(x).set(y,obj);
}
}
or should i do it by storing it
public class Grid
{
private ArrayList<ArrayList<obj>> objs = new ArrayList<...>();
public void addObj( Obj obj, int x, int y)
{
objs.get(x).set(y,obj);
}
}
help plz