I am doing a heavy operation with arrayList from array lists. when I try to display a list of parent arrays, I have a problem with displaying empty arraylists, as shown below
The declaration of myListList is listed below.
List<List<String>> arrayList = new ArrayList<List<String>>();
Here is a list of my children
List<String> stringLine = new ArrayList<String>();
In my program, I add this LineLine to an array like this
arrayList.add(stringLine);
My conclusion when trying to print the parent array of List the print size of the array of List is still 44: [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []]
Note. In the above output 44 there are no array elements that it has
When I try to print a child, it displays a good
StringLine is : [1640, 1138, 878, 1600, 1978, 280, 24, 2509, 702, 553, 2362, 2019, 1558, 2494, 823, 35, 1181, 1915, 1261, 1448, 493, 798, 1160, 651, 2249, 1639, 2428, 458, 2556, 939, 2114, 2339, 2373, 286, 2078, 844, 2673, 1486, 1657, 1531, 1043, 734, 2247, 2121, 75, 2599, 975, 29, 175, 960, 2151, 480, 868, 2627, 1941, 671, 2529, 1952, 1623, 2160, 2298]
Where am I wrong?
UPDATE:
Here is my code snippet in which I add a list to the parent array of List
private void splitString(String temp) { System.out.println("In splitString method.."); List<String> stringLine = new ArrayList<String>(); StringTokenizer stringTokenizer = new StringTokenizer(temp, " "); while (stringTokenizer.hasMoreTokens()) { stringLine.add(stringTokenizer.nextToken()); } if (stringLine.size() != 3) { arrayList.add(stringLine); } stringLine.clear(); }