Skip to content

List of array in Android

I am creating OMR scanner in java. I have List of which contains contours from image. i want to create array of List. how can i accomplish it?

this is what i have right now

List<MatOfPoint> questions = new ArrayList<MatOfPoint>();

What i want to do is

List<MatOfPoint>[] questions = new ArrayList<MatOfPoint>[];

so that i can store array of countours() for each question. Like

[1] contour1,contour2,contour3,contour4,contour5

[2] contour1,contour2,contour3,contour4,contour5

[3] contour1,contour2,contour3,contour4,contour5




It’s probably better to just use a list of list. But you can do something like this:

List<MatOfPoint>[] questions = (ArrayList<MatOfPoint>[]) new ArrayList[n];
User contributions licensed under: CC BY-SA
3 People found this is helpful