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

9
LINES

< > BotCompany Repo | #1020632 // setWithNotify - returns synchronized notifying set

JavaX fragment (include)

static <A> Set<A> setWithNotify(final Runnable onChange) {
  ret setWithNotify(new HashSet, onChange);
}

static <A> Set<A> setWithNotify(Set<A> set, final Runnable onChange) {
  ret new NotifyingSet<A>(set) {
    void change() { onChange.run(); }
  };
}

Author comment

Began life as a copy of #1012662

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1020632
Snippet name: setWithNotify - returns synchronized notifying set
Eternal ID of this version: #1020632/3
Text MD5: 24984efe509d94f017dc40dd461236e9
Author: stefan
Category: javax / collections
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-11 14:40:42
Source code size: 262 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 266 / 308
Version history: 2 change(s)
Referenced in: [show references]