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

11
LINES

< > BotCompany Repo | #1002392 // makeEleuSet - makes a set from askSelf question ("is X an Y?")

JavaX fragment (include)

static Set<S> makeEleuSet(final S className) {
  // It's a "degenerate" set that only supports contains().
  
  ret new AbstractSet<S>() {
    public Iterator<S> iterator() { ret null; }
    public int size() { ret -1; }
    public boolean contains(O o) {
      ret matchStart("yes", askSelf(format("is * " + a(className), ((S) o))));
    }
  };
}

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: #1002392
Snippet name: makeEleuSet - makes a set from askSelf question ("is X an Y?")
Eternal ID of this version: #1002392/1
Text MD5: d74ecb2e339e2a595068734ff488880a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-01-18 21:12:58
Source code size: 357 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 686 / 898
Referenced in: #1002427 - Accellerating 629 (SPIKE)
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1010953 - ImmutableSortedList - more compact than a TreeSet
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)