I am trying to get a sublist of a List
but I want the sublist to be serialized. I found out that when we get sublist from an ArrayList
the sublist is not serialized.
To overcome this, this is what I am doing:
ArrayList serializedSublist = new ArrayList();
//getQuestions() returns RandomAccessSubList
getQuestions().addAll(serializedSublist);
//problem is in the line below. serializedSublist is empty.
getRequest().getSession().setAttribute("questionsForUser", serializedSublist);
Problem is that serializedSubList
is empty in line 5, eventhough in line 3 getQuestions()
returns a list back.