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

11
LINES

< > BotCompany Repo | #1022693 // minimalNotifyingMap - only allows put()

JavaX fragment (include)

1  
static <A, B> Map<A, B> minimalNotifyingMap(Map<A, B> map, Runnable notify) {
2  
  ret new AbstractMap<A, B>() {
3  
    public Set<Map.Entry<A, B>> entrySet() { throw unimplemented(); }
4  
    
5  
    public B put(A a, B b) {
6  
      B result = map.put(a, b);
7  
      pcallF(notify);
8  
      ret result;
9  
    }
10  
  };
11  
}

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: #1022693
Snippet name: minimalNotifyingMap - only allows put()
Eternal ID of this version: #1022693/4
Text MD5: b118705d35d1b850880587122314089b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-31 19:45:17
Source code size: 308 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 299 / 342
Version history: 3 change(s)
Referenced in: [show references]