当前位置: 动力学知识库 > 问答 > 编程问答 >

java - ArrayList<File> sorting by file.length()

问题描述:

This question already has an answer here:

  • Comparator won't work with Arrays.sort

    5 answers

网友答案:

Arrays.sort expects an array. Use Collections.sort in order to sort a List.

public ArrayList<File> sort(ArrayList<File> arrayOfFiles) 
{
    Collections.sort(arrayOfFiles, new ArraySorting());
    return arrayOfFiles;
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: