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

30
LINES

< > BotCompany Repo | #1004686 // addAll - generalizes Collection.addAll + synonym of addComponents

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

Libraryless. Click here for Pure Java version (5207L/29K).

static <A, B extends A> void addAll(Collection<A> c, Iterable<B> b) {
  if (c != null && b != null) for (A a : b) c.add(a);
}

static <A, B extends A> bool addAll(Collection<A> c, Collection<B> b) {
  ret c != null && b != null && c.addAll(b);
}

static <A, B extends A> bool addAll(Collection<A> c, B... b) {
  ret c != null && b != null && c.addAll(Arrays.asList(b));
}

ifclass Collector
static <A, B extends A> void addAll(Collector<A> c, Iterable<B> b) {
  if (c != null && b != null) for (A a : b) c.add(a);
}
endif

static <A, B> Map<A, B> addAll(Map<A, B> a, Map<? extends A,? extends B> b) {
  if (a != null && b != null) a.putAll(b);
  ret a;
}

static <A extends Container> A addAll(A c, Cl<? extends Component> components) {
  ret addComponents(c, components);
}

static <A extends Container> A addAll(A c, Component... components) {
  ret addComponents(c, components);
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004686
Snippet name: addAll - generalizes Collection.addAll + synonym of addComponents
Eternal ID of this version: #1004686/17
Text MD5: 2439c692b51c981cec8448307653d58c
Transpilation MD5: 9e13ae9a25a64ff57ac506c2f3549513
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-08 01:30:20
Source code size: 912 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 873 / 1363
Version history: 16 change(s)
Referenced in: [show references]