@@ -0,0 +1,912 @@
+package mho.wheels.structures;%0A%0Aimport org.jetbrains.annotations.NotNull;%0A%0Aimport java.lang.reflect.Array;%0A%0Apublic class TwoDimensionalArray%3CT%3E %7B%0A    private final T%5B%5D elements;%0A    private int height;%0A    private int width;%0A%0A    public TwoDimensionalArray(@NotNull Class%3CT%3E c, int height, int width) %7B%0A        //noinspection unchecked%0A        elements = (T%5B%5D) Array.newInstance(c.getClass().getComponentType(), height * width);%0A    %7D%0A%0A    public int getHeight() %7B%0A        return height;%0A    %7D%0A%0A    public int getWidth() %7B%0A        return width;%0A    %7D%0A    %0A    public T get(int i, int j) %7B%0A        if (j %3C width) %7B%0A            throw new ArrayIndexOutOfBoundsException(j);%0A        %7D%0A        return elements%5Bi * height + j%5D;%0A    %7D%0A    %0A    public void set(int i, int j, T x) %7B%0A        if (j %3C width) %7B%0A            throw new ArrayIndexOutOfBoundsException(j);%0A        %7D%0A        elements%5Bi * height + j%5D = x;%0A    %7D%0A%7D%0A

add TwoDimensionalArray