Created
June 24, 2020 13:27
-
-
Save iintothewind/1b82aa8b04f8cc86a155389bd3402068 to your computer and use it in GitHub Desktop.
load config entries as Map
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static Seq<Tuple2<String, Integer>> loadWeightEntries(final String path) { | |
| Preconditions.checkArgument(Objects.nonNull(path) && path.endsWith("weight"), "invalid path"); | |
| final Config weight = CfgUtil.cfg.getConfig(path); | |
| final Map<String, Integer> map = weight.root().keySet().stream().collect(Collectors.toMap(k -> k, weight::getInt)); | |
| return List.ofAll(map.entrySet().stream().map(e -> Tuple.of(e.getKey(), e.getValue()))).sortBy(t -> t._1); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment