How to convert Map to Map ? (option : using guava)

前端 未结 6 881
礼貌的吻别
礼貌的吻别 2020-12-10 01:16

I have a Map the String key is nothing but numeric value like \"123\" etc. I\'m getting numeric value because this values are

6条回答
  •  再見小時候
    2020-12-10 01:28

    Answer using Java 8 and jOOλ

    private static  Map mapKeys(Map map, Function keyMapper) {
        return Seq.seq(map).map(t -> t.map1(keyMapper)).toMap(Tuple2::v1, Tuple2::v2);
    }
    

提交回复
热议问题