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

10
LINES

< > BotCompany Repo | #1012265 - mapPairs - iterate over a map in key-value pairs

JavaX fragment (include)

static <A, B> IterableIterator<Pair<A, B>> mapPairs(Map<A, B> map) {
  final Iterator<Map.Entry<A, B>> it = map.entrySet().iterator();
  ret iteratorFromFunction(func -> Pair<A, B> {
    if (it.hasNext()) {
      Map.Entry<A, B> entry = it.next();
      ret pair(entry.getKey(), entry.getValue());
    }
    null;
  });
}

download  show line numbers  debug dex   

Travelled to 10 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz, whxojlpjdney

No comments. add comment

Snippet ID: #1012265
Snippet name: mapPairs - iterate over a map in key-value pairs
Eternal ID of this version: #1012265/2
Text MD5: 4b1b1d23ce2ac731ea4cfd6df2293fd1
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-26 20:04:55
Source code size: 330 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 238 / 226
Version history: 1 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1012265 & http://1012265.tinybrain.de