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

10
LINES

< > BotCompany Repo | #1001026 // extended eq function equating BigIntegers with ints/longs

JavaX fragment (include)

static boolean eq(Object a, Object b) {
  if (a == null) return b == null;
  if (a == b) true;
  if (a.equals(b)) true;
  if (a instanceof BigInteger) {
    if (b instanceof Integer) return a.equals(BigInteger.valueOf((Integer) b));
    if (b instanceof Long) return a.equals(BigInteger.valueOf((Long) b));
  }
  return false;
}

Author comment

Began life as a copy of #1000860

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001026
Snippet name: extended eq function equating BigIntegers with ints/longs
Eternal ID of this version: #1001026/3
Text MD5: bdd77db2e5d1a1dda343ca75a5cdc018
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-04-26 12:13:02
Source code size: 337 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 663 / 7569
Version history: 2 change(s)
Referenced in: [show references]