Libraryless. Click here for Pure Java version (4782L/27K).
1 | // newest first |
2 | static L<File> sortFilesByDateDesc(Collection<File> files) {
|
3 | ret sortedByComparator(files, new Comparator<File>{
|
4 | AutoMap<File, Long> dates = new AutoMap<File, Long>(lambda1 lastModified); // cache to ensure comparator is sane |
5 | |
6 | public int compare(File b, File a) {
|
7 | long x = dates.get(a), y = dates.get(b); |
8 | return x < y ? -1 : x == y ? 0 : 1; |
9 | } |
10 | }); |
11 | } |
Began life as a copy of #1003182
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1015308 |
| Snippet name: | sortFilesByDateDesc |
| Eternal ID of this version: | #1015308/10 |
| Text MD5: | 100c5514396ddf1cfe77f97fa620802f |
| Transpilation MD5: | e0b1445013f9c855d76fde248227201e |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-10-29 02:16:45 |
| Source code size: | 406 bytes / 11 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 780 / 956 |
| Version history: | 9 change(s) |
| Referenced in: | [show references] |