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

9
LINES

< > BotCompany Repo | #1004369 // keysStartingWith - sub-map of TreeMap with all keys that start with x - TODO: rename

JavaX fragment (include)

1  
static <T> Map<S, T> keysStartingWith(String x, TreeMap<S, T> map) {
2  
  if (empty(x)) ret map;
3  
  S lastKey = lexicographicallyNextString(x);
4  
  ret map.subMap(x, true, lastKey, false);
5  
}
6  
7  
static <T> Map<S, T> keysStartingWith(TreeMap<S, T> map, String x) {
8  
  ret keysStartingWith(x, map);
9  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004369
Snippet name: keysStartingWith - sub-map of TreeMap with all keys that start with x - TODO: rename
Eternal ID of this version: #1004369/3
Text MD5: de69d6d88c329e4ca06eedfa1a66aa87
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-26 09:21:08
Source code size: 292 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 593 / 601
Version history: 2 change(s)
Referenced in: [show references]