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

23
LINES

< > BotCompany Repo | #1032887 // MutatingMap [interface proposal for a map that can "shape-shift" (replace itself with a different object)]

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

Libraryless. Click here for Pure Java version (3846L/22K).

// This is probably for use in Meta_v2 to get the most efficient
// (read compact) implementation of typical meta scenarios.

interface MutatingMap<A, B> {
  // Non-mutating:
  
    bool isEmpty();
    int size();
    ItIt<Pair<A, B>> iterator();
    bool containsKey(A a);
    B get(A a);
  
  // hashCode/equals, not sure.
  // maybe we shouldn't even have value semantics here
    
  // Mutating:
  
    MutatingMap<A, B> put(A a, B b);
    MutatingMap<A, B> remove(A a);
    MutatingMap<A, B> putAll(Map map);
    MutatingMap<A, B> putAll(MutatingMap map);
    MutatingMap<A, B> clear();
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1032887
Snippet name: MutatingMap [interface proposal for a map that can "shape-shift" (replace itself with a different object)]
Eternal ID of this version: #1032887/3
Text MD5: 2f3bef87f542db0ba5caea73d0d9c216
Transpilation MD5: 944afe1a6db67f449f03747e52f24d67
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-07 14:45:47
Source code size: 615 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 177 / 291
Version history: 2 change(s)
Referenced in: #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)