I have a code here that getting the List of List in java. But my problem now is the result in my server was repeatable...
Example
[2012-01-04, 3 , 2012-02-04, 4, 2012-05-04, 3][2012-01-04, 3 , 2012-02-04, 4, 2012-05-04, 3][2012-01-04, 3 , 2012-02-04, 4, 2012-05-04, 3]
The value number of value inside my array is the same 3 group of arrays appearing.
This is my code. please help me.
SortedSet<String> uniqueSet = new TreeSet<String>(arrlist);
ArrayList<ArrayList<String>> listOLists = new ArrayList<ArrayList<String>>();
// List<String> flat = list.stream().flatMap(List::stream).collect(Collectors.toList());
ArrayList<String> singleList = new ArrayList<String>();
for(String date : uniqueSet) {
int counts = Collections.frequency(arrlist, date);
Logger.debug("date: "+ date + " counts: " +counts);
singleList.add(date);
singleList.add(Integer.toString(counts));
listOLists.add(singleList);
}
Logger.debug("Sample List: " + listOLists);
return listOLists;
}