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

25
LINES

< > BotCompany Repo | #1022177 // class LinkedTreeMap [dev., not ready]

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (2513L) is out of date.

1  
static class LinkedTreeMap<A, B> extends AbstractMap<A, B> {
2  
  Map<A, B> map;
3  
  new LinkedList<A> list;
4  
5  
  *() { map = new TreeMap; }
6  
  *(Map<A, B> *map) {}
7  
8  
  public B get(Object key) {
9  
    ret map.get(key);
10  
  }
11  
  
12  
  public B put(A key, B value) {
13  
    if (!map.containsKey(key))
14  
      list.add(key);
15  
    return map.put(key, value);
16  
  }
17  
  
18  
  public bool containsKey(O key) {
19  
    ret map.containsKey(key);
20  
  }
21  
  
22  
  public Set<Map.Entry<A,B>> entrySet() {
23  
    ret map.entrySet();
24  
  }
25  
}

Author comment

Began life as a copy of #1018325

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: #1022177
Snippet name: class LinkedTreeMap [dev., not ready]
Eternal ID of this version: #1022177/4
Text MD5: 4478cb32497b39ce8b2e229c76a510f7
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-09-07 14:11:05
Source code size: 509 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 253 / 287
Version history: 3 change(s)
Referenced in: [show references]