Created
December 4, 2010 03:26
-
-
Save jbrechtel/727882 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def lastModifiedDate(app: ApplicationInfo) = (new File(app.sourceDir)).lastModified() | |
| val sortedApps = repository.all.sortWith(lastModifiedDate(_) > lastModifiedDate(_)) | |
| VS | |
| private List<ApplicationInfo> getApplicationsSortedByDate(List<ApplicationInfo> apps) { | |
| Comparator<ApplicationInfo> dateComparator = new Comparator<ApplicationInfo>() { | |
| public int compare(ApplicationInfo appInfo1, ApplicationInfo appInfo2) { | |
| long date1 = new File(appInfo1.sourceDir).lastModified(); | |
| long date2 = new File(appInfo2.sourceDir).lastModified(); | |
| return new Long(date1).compareTo(date2); | |
| } | |
| }; | |
| Collections.sort(apps, dateComparator); | |
| return apps; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment