Currently I am working on List of Lists. I stumbled on this question (I mean, selected answer). List of Lists of Lists
@Mario Fusco is pointing to have better abstraction with classes and objects. Honestly, I don't get it whether the use-case applies to all scenario. For instance, I have a list(of list ):
[[2, 5, 6, 7], [8, 10, 12, 13, 15], [6, 13, 23, 25, 30, 34], [16, 25], [5, 16, 25, 30], [6, 25, 30], [1, 5, 9, 13, 14], [14, 25], [2, 6, 12, 34], [2, 5, 25], [2, 3, 31], [1, 16, 19], [2, 34], [3, 6], [8, 10, 12, 13, 15], [5, 10], [1, 8, 14], [3, 5], [1, 2, 8, 9, 13, 15], [3, 6, 13], [8, 15], [25, 34], [25, 31], [5, 23], [30, 31], [8, 10, 12, 13, 15], [30, 34], [8, 10, 12, 13, 15], [25, 31], [25, 31], [5, 23, 34], [3, 5, 8, 10, 12, 13, 15], [2, 8, 9, 12, 13, 15], [2, 15]]
/* I created it using ArrayList<ArrayList<Integer>> and few previous processing.
And I need to do simple processing on it like count occurrence of 2,5 etc, find duplicate sets in list(of list) and so on. Will it be intelligent to create a class for inner list and then add those objects to list (each object containing ArrayList of these numbers). I am a bit confused with options available at this moment and need to figure out which way should work better. I would feel overwhelmed if you could explain me some example, use-case.
Edit: I am From Python background and very friendly with playing list and list of lists etc. But working on large datasets was a bit problem there (no offensive intention, there are good things like Cython, but it is just for requirement), hence shifted to Java for part of problem.
Can I change the direction of question and ask which approach will be better for memory management and CPU perspective ? Number of sublists may grow to nearly half a million to million each containing 2-10 numbers.