Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

array to map java

Map<String, Double> kvs =
    Arrays.asList("a:1.0", "b:2.0", "c:3.0")
        .stream()
        .map(elem -> elem.split(":"))
        .collect(Collectors.toMap(e -> e[0], e -> Double.parseDouble(e[1])));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #array #map #java
ADD COMMENT
Topic
Name
3+9 =