What I would like to achieve is to have a nested list (or array) with elements as lists (or arrays) consisting a pair of integers. This is to store some data and I would like to access those integers efficiently.
So I created a nested list in Java like this:
List combined = new ArrayList();
int x[] = new int[2];
List segl = Arrays.asList(x)
combined.addAll(segl);
the nested list will later be appended with more list like segl.
Now I want to return a element from combined. But with combined.get(0) the returned element data type is object instead of a list like segl, so I couldn't do anything with it (eg. return the single int element from segl. I have no idea how to change it to a list or array.
ListandArrayListexpect a type parameter to be given:List<int[]>. Oh, and I suggest not to mix arrays andLists, unless you have a compelling reason to do so.Objectsbecause you are using raw types. However, could you expand on what you are trying to achieve? Iscombinedsupposed to be a 'List of Lists'? (e.g.List<List<Integer>?)