Created
June 24, 2020 13:27
-
-
Save iintothewind/1b82aa8b04f8cc86a155389bd3402068 to your computer and use it in GitHub Desktop.
Revisions
-
iintothewind created this gist
Jun 24, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ 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); }