Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

19
LINES

< > BotCompany Repo | #1006221 // sortedDesc - takes a Collection<A> and an optional func(A, A) -> int

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (9196L/51K).

static <A> L<A> sortedDesc(Collection<A> c, O comparator) {
  L<A> l = cloneList(c);
  sort(l, makeReversedComparator(comparator));
  ret l;
}

static <A> L<A> sortedDesc(Collection<A> c, Comparator<A> comparator) {
  L<A> l = cloneList(c);
  sort(l, makeReversedComparator(comparator));
  ret l;
}

// TODO: should use a reverse comparator to keep sort stable
static <A> L<A> sortedDesc(Collection<A> c) {
  L<A> l = cloneList(c);
  sort(l);
  Collections.reverse(l);
  ret l;
}

Author comment

Began life as a copy of #1003400

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006221
Snippet name: sortedDesc - takes a Collection<A> and an optional func(A, A) -> int
Eternal ID of this version: #1006221/3
Text MD5: 9e915a64114377d6506e1d2ec6b138fe
Transpilation MD5: 31af186979d7d4e3ad5c4ebb8ecd2c99
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-07-25 16:07:52
Source code size: 497 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 510 / 546
Version history: 2 change(s)
Referenced in: [show references]