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

21
LINES

< > BotCompany Repo | #1002041 // cmp function (standard compare)

JavaX fragment (include)

static int cmp(Number a, Number b) {
  ret a == null ? b == null ? 0 : -1 : cmp(a.doubleValue(), b.doubleValue());
}

static int cmp(double a, double b) {
  ret a < b ? -1 : a == b ? 0 : 1;
}

static int cmp(int a, int b) {
  ret a < b ? -1 : a == b ? 0 : 1;
}

static int cmp(long a, long b) {
  ret a < b ? -1 : a == b ? 0 : 1;
}

static int cmp(O a, O b) {
  if (a == null) ret b == null ? 0 : -1;
  if (b == null) ret 1;
  ret ((Comparable) a).compareTo(b);
}

Author comment

Began life as a copy of #1001540

download  show line numbers  debug dex  old transpilations   

Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1002041
Snippet name: cmp function (standard compare)
Eternal ID of this version: #1002041/4
Text MD5: 9fc9492b222d98c9638e682d61d38675
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-08-05 17:42:49
Source code size: 483 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 728 / 2244
Version history: 3 change(s)
Referenced in: [show references]