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

17
LINES

< > BotCompany Repo | #1008841 // setAll - returns the object

JavaX fragment (include)

static <A> A setAll(A o, Map<S, O> fields) {
  if (fields == null) ret o;
  for (S field : keys(fields))
    set(o, field, fields.get(field));
  ret o;
}

static <A> A setAll(A o, O... values) {
  //values = expandParams(c.getClass(), values);
  failIfOddCount(values);
  for (int i = 0; i+1 < l(values); i += 2) {
    S field = (S) values[i];
    O value = values[i+1];
    set(o, field, value);
  }
  ret o;
}

Author comment

Began life as a copy of #1004782

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1008841
Snippet name: setAll - returns the object
Eternal ID of this version: #1008841/4
Text MD5: e5bfb2414e6c8c3f84dafddc32504861
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-09 11:06:49
Source code size: 427 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 653 / 721
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1017354 - setAllAndReturn
#1026585 - dm_setAll - set multiple fields in module