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.

1  
static <A> L<A> minus(Collection<A> a, O... b) {
2  
  Set set = asSet(b);
3  
  new L l;
4  
  for (O s : unnull(a))
5  
    if (!set.contains(s))
6  
      l.add(s);
7  
  ret l;
8  
}
9  
10  
static BigInteger minus(BigInteger a, BigInteger b) {
11  
  ret a.subtract(b);
12  
}
13  
14  
ifclass Complex
15  
static Complex minus(Complex c) {
16  
  ret c == null ?: complex(-c.re(), -c.im());
17  
}
18  
endif
19  
20  
meta-for int also as double, long {
21  
  static int minus(int a, int b) {
22  
    ret a-b;
23  
  }
24  
  
25  
  static int minus(int a) {
26  
    ret -a;
27  
  }
28  
}

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: 637 / 717
Version history: 9 change(s)
Referenced in: [show references]