Hashmap to Java Object mapping in java 8

Viewed 50

I have a map of

Map<String,Set<String>>

. i want to map each entry into an Class A and create a list of type A .

class A {
String Key;
Set<String> Value;
}

Is this correct way of doing this?

map.entryset().stream().map(entry-> new A(entry.key(),entry.value())).collect(collectors.toList())
0 Answers
Related