I have a JSF page that displays a list of Glassfish log files. I use lazy loading for pagination. I save a list of log file names in a Java List .
private List<directoryListObj> dataList = new ArrayList<>(); dataList = dataList.subList(firstRow, lastRow);
And here is the problem. For example, I have 35 files in a directory. When i do it
dataList = dataList.subList(5, 15);
It works great. But when I do this:
dataList = dataList.subList(30, 38);
I get the wrong error index because I want to get the index outside the list. How can I, for example, return list items from 30 to 35? I want if I want to get an index from 30 to 40, but if there are only 35 indexes, to get only 5.
java
user1285928 Aug 23 2018-12-12T00: 00Z
source share