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

15
LINES

< > BotCompany Repo | #1021317 // CombinedSet - only supports size() [estimated] and contains()

JavaX fragment (include)

static class CombinedSet<A> extends AbstractSet<A> {
  new L<Set<A>> sets;

  *() {}
  *(Set<A>... sets) { addAllNonNulls(this.sets, sets); }

  public int size() { ret lengthLevel2(sets); }
  public Iterator<A> iterator() { fail(); }
  public bool contains(O o) {
    for (Set<A> set : sets)
      if (set.contains(o))
        true;
    false;
  }
}

Author comment

Began life as a copy of #1018030

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021317
Snippet name: CombinedSet - only supports size() [estimated] and contains()
Eternal ID of this version: #1021317/6
Text MD5: 34d4eb23aca2f5e6ce7f841be6b06193
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-15 12:57:24
Source code size: 366 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 318 / 815
Version history: 5 change(s)
Referenced in: #1022348 - AllContainingSet - basically only contains() and add()
#1022360 - CombinedMap - only supports containsKey() and get()
#1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)