public MapgetFileList(String path, int from, int to) {
Mapmap = new HashMap<>();
ListfileList = new ArrayList<>();
int total = 0;
if(new File(path).exists()){
File[] fileArr = new File(path).listFiles();
if (fileArr != null && fileArr.length > 0) {
total = fileArr.length;
if (to >= fileList.size()) {
to = fileList.size();
}
for (int i = from; i < to; i++) {
fileList.add(fileList.get(i));
}
}
}
map.put("total", total);
map.put("fileList", fileList);
return map;
}
public Map
Map
List
int total = 0;
if(new File(path).exists()){
File[] fileArr = new File(path).listFiles();
if (fileArr != null && fileArr.length > 0) {
total = fileArr.length;
if (to >= fileArr.length) {
to = fileArr.length;
}
for (int i = from; i < to; i++) {
fileList.add(fileArr[i].getPath());
}
}
}
map.put("total", total);
map.put("fileList", fileList);
return map;
}