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

22
LINES

< > BotCompany Repo | #1017455 // class DerivedMap - base map + additions

JavaX fragment (include)

1  
static class DerivedMap<A, B> extends AbstractMap<A, B> {
2  
  Map<A, B> base;
3  
  Map<A, B> additions = new HashMap;
4  
  
5  
  *() {}
6  
  *(Map<A, B> *base) {}
7  
  *(Map<A, B> *base, Map<A, B> *additions) {}
8  
  
9  
  public B get(Object key) {
10  
    B b = additions.get(key);
11  
    if (b != null) return b;
12  
    return base.get(key);
13  
  }
14  
  
15  
  public B put(A key, B value) {
16  
    return additions.put(key, value);
17  
  }
18  
  
19  
  public Set<Map.Entry<A,B>> entrySet() {
20  
    throw fail();
21  
  }
22  
}

Author comment

Began life as a copy of #1001027

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1017455
Snippet name: class DerivedMap - base map + additions
Eternal ID of this version: #1017455/3
Text MD5: ce3a0bfc02a4e07881e809726c307818
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-22 13:41:28
Source code size: 485 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 313 / 881
Version history: 2 change(s)
Referenced in: [show references]