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.

static class LinkedTreeMap<A, B> extends AbstractMap<A, B> {
  Map<A, B> map;
  new LinkedList<A> list;

  *() { map = new TreeMap; }
  *(Map<A, B> *map) {}

  public B get(Object key) {
    ret map.get(key);
  }
  
  public B put(A key, B value) {
    if (!map.containsKey(key))
      list.add(key);
    return map.put(key, value);
  }
  
  public bool containsKey(O key) {
    ret map.containsKey(key);
  }
  
  public Set<Map.Entry<A,B>> entrySet() {
    ret map.entrySet();
  }
}

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: 318 / 362
Version history: 3 change(s)
Referenced in: [show references]