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

12
LINES

< > BotCompany Repo | #1013072 // keysStartingWith2 - returns a set

JavaX fragment (include)

1  
static <A> Collection<S> keysStartingWith2(S prefix, Map<S, A> map) {
2  
  if (empty(prefix)) ret keys(map);
3  
  if (map instanceof NavigableMap) {
4  
    S lastKey = lexicographicallyNextString(prefix);
5  
    ret keys(((NavigableMap) map).subMap(prefix, true, lastKey, false));
6  
  }
7  
  ret startingWith(prefix, keys(map));
8  
}
9  
10  
static <A> Collection<S> keysStartingWith2(Map<S, A> map, S prefix) {
11  
  ret keysStartingWith2(prefix, map);
12  
}

Author comment

Began life as a copy of #1004369

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1013072
Snippet name: keysStartingWith2 - returns a set
Eternal ID of this version: #1013072/4
Text MD5: 7ce4be71f2f26e76d56dfb7f296e7074
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-24 19:41:32
Source code size: 435 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 333 / 362
Version history: 3 change(s)
Referenced in: [show references]