Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static LinkedList<File> sortFileList (LinkedList<File> f,int maxEbene)
- {
- LinkedList<File> sFL = new LinkedList<File>();
- char bs = '\\';
- int actbslash = 0;
- int lastbslash = 0;
- while(maxEbene != 0)
- {
- for(int i = 0; i < f.size();i++)
- {
- int anzbslash =-1;
- int lastindexofbslash = f.get(i).getPath().lastIndexOf(bs);
- //While Schleife um die genaue Anazhl aller '/' Indizes zu finden und abzuspeichern.
- do
- {
- //Feststellen des "nächsten" '/' im Pfad
- actbslash = f.get(i).getPath().indexOf(bs,lastbslash+1);
- lastbslash = actbslash; //Index des aktuellen '/' in das Array schreiben
- anzbslash++;
- }
- while(actbslash != lastindexofbslash);
- if(maxEbene == anzbslash)
- {
- sFL.add(f.get(i));
- System.out.println(sFL.getLast());
- f.remove(i);
- }
- }
- maxEbene--;
- }
- return sFL;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement