resolve a java.util.ArrayList$SubList notSerializable Exception

It’s because, List returned by subList() method is an instance of ‘RandomAccessSubList’ which is not serializable. Therefore you need to create a new ArrayList object from the list returned by the subList().

List<String> list = new ArrayList<String>(originalList.subList(0, 10));

Leave a Comment