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

11
LINES

< > BotCompany Repo | #1036502 // multiMapSingletonPairs - get key+value pairs where key only has one value

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

Libraryless. Click here for Pure Java version (9947L/55K).

meta-for MultiMap also as MultiSetMap {
  static <A, B> LPair<A, B> multiMapSingletonPairs(MultiMap<A, B> mm) {
    new LPair<A, B> out;
    if (mm != null) for (A key : mm.keySet()) {
      var values = mm.get(key);
      if (l(values) == 1)
        out.add(pair(key, first(values)));
    }
    ret out;
  }
}

Author comment

Began life as a copy of #1004755

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1036502
Snippet name: multiMapSingletonPairs - get key+value pairs where key only has one value
Eternal ID of this version: #1036502/5
Text MD5: 9db8b831ec4846921210c57519204ed0
Transpilation MD5: e14a1aa8440336a3d0f839ea9b341f8b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-01-07 20:47:19
Source code size: 320 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 76 / 121
Version history: 4 change(s)
Referenced in: [show references]