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

28
LINES

< > BotCompany Repo | #1002986 // minus - get list without certain elements; subtract BigIntegers

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

Transpiled version (5003L) is out of date.

static <A> L<A> minus(Collection<A> a, O... b) {
  Set set = asSet(b);
  new L l;
  for (O s : unnull(a))
    if (!set.contains(s))
      l.add(s);
  ret l;
}

static BigInteger minus(BigInteger a, BigInteger b) {
  ret a.subtract(b);
}

ifclass Complex
static Complex minus(Complex c) {
  ret c == null ?: complex(-c.re(), -c.im());
}
endif

meta-for int also as double, long {
  static int minus(int a, int b) {
    ret a-b;
  }
  
  static int minus(int a) {
    ret -a;
  }
}

Author comment

Began life as a copy of #1001927

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, wtqryiryparv

No comments. add comment

Snippet ID: #1002986
Snippet name: minus - get list without certain elements; subtract BigIntegers
Eternal ID of this version: #1002986/10
Text MD5: 5a0ad9f932a3b7310427c20587cf45c7
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-10-17 01:52:40
Source code size: 506 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 632 / 709
Version history: 9 change(s)
Referenced in: [show references]