public static ArrayList<FileListItem> prepareFileListEntries(ArrayList<FileListItem> internalList,File inter,ExtensionFilter filter){
  try {
    for (    File name : inter.listFiles(filter)) {
      if (name.canRead()) {
        FileListItem item=new FileListItem();
        item.setFilename(name.getName());
        item.setDirectory(name.isDirectory());
        item.setLocation(name.getAbsolutePath());
        item.setTime(name.lastModified());
        internalList.add(item);
      }
    }
    Collections.sort(internalList);
  }
 catch (  NullPointerException e) {
    e.printStackTrace();
    internalList=new ArrayList<>();
  }
  return internalList;
}

public static ArrayList < FileListItem > prepareFileListEntries ( ArrayList < FileListItem > internalList , File inter , ExtensionFilter filter ) { try { for ( File name : inter . listFiles ( filter ) ) { if ( name . canRead ( ) ) { FileListItem item = new FileListItem ( ) ; item . setFilename ( name . getName ( ) ) ; item . setDirectory ( name . isDirectory ( ) ) ; item . setLocation ( name . getAbsolutePath ( ) ) ; item . setTime ( name . lastModified ( ) ) ; internalList . add ( item ) ; } } Collections . sort ( internalList ) ; } catch ( NullPointerException e ) { e . printStackTrace ( ) ; internalList = new ArrayList < > ( ) ; } return internalList ; }
prepares the list of files and folders inside ' inter ' directory . the list can be filtered through extensions . ' filter ' reference is the filefilter . a reference of arraylist is passed , in case it may contain the listitem for parent directory . returns the list of directories / files in the form of arraylist .
