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

13
LINES

< > BotCompany Repo | #1002452 - sortedByField

JavaX fragment (include)

static <A> L<A> sortedByField(Collection<A> c, final S field) {
  L<A> l = new ArrayList(c);
  sort(l, new Comparator<A>() {
    public int compare(A a, A b) {
      ret cmp(getOpt(a, field), getOpt(b, field));
    }
  });
  ret l;
}

static <A> L<A> mapMethodLike sortedByField(S field, Collection<A> c) {
  ret sortedByField(c, field);
}

Author comment

Began life as a copy of #1002319

download  show line numbers  debug dex   

Travelled to 9 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1002452
Snippet name: sortedByField
Eternal ID of this version: #1002452/2
Text MD5: 9f6d74be958833b82b6b1bfbd2ba4987
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-05-11 13:43:18
Source code size: 351 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 432 / 393
Version history: 1 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1002452 & http://1002452.tinybrain.de