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

20
LINES

< > BotCompany Repo | #1006064 // intSum - add field of list << great wording

JavaX fragment (include)

static int intSum(Collection c, S field) {
  int sum = 0;
  for (O o : unnull(c))
    sum += toInt(getOpt(o, field));
  ret sum;
}

static int intSum(Iterable<Int> l) {
  int sum = 0;
  for (Int i : unnull(l))
    if (i != null) sum += i;
  ret sum;
}

static int intSum(int... l) {
  int sum = 0;
  for (int i : unnull(l))
    sum += i;
  ret sum;
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1006064
Snippet name: intSum - add field of list << great wording
Eternal ID of this version: #1006064/5
Text MD5: 9a10721757938fbb9bd24061ad121c17
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-08 08:10:48
Source code size: 369 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 501 / 548
Version history: 4 change(s)
Referenced in: [show references]