Archive | sort
RSS for this section
How to sort java collection?
Sort by specific element:
case1: sort by file name
Collection => List<File> fileList = new ArrayList<File>();
(ref: number of IO comparator can be used in apache commons)
import org.apache.commons.io.comparator.NameFileComparator;
Collections.sort(fileList, NameFileComparator.NAME_COMPARATOR);
ref:
http://www.java2s.com/Code/Java/Apache-Common/ComparatorExampleForUserDefinedClass.htm