読者です 読者をやめる 読者になる 読者になる

SHIBUYA 3%

(元在宅が)渋谷で働くエンジニアの備忘録的memo & 雑記 - ココロはいつもSHIBUYAに在り

Java8で二次元配列をMapに変換するメモ

private static final String[][] PARAMETERS = {
        {"param1","1"},
        {"param2","2"},
        {"param3","3"},
        {"param4","4"},
        {"param5","5"},
        {"param6","6"},
        {"param7","7"},
        {"param8","8"},
        {"param9","9"},
        {"param10","10"}
};
Map<String, String> paramMap = Stream.of(PARAMETERS).collect(Collectors.toMap(
        s -> s[0],
        s -> s[1],
        (s1, s2) -> s1
));