java - Creating possible combinations from Hashmap -
i have hashmap below
{ hhsize=[hhsize4+, hhsize1, hhsize2, hhsize3], aob=[aob<30, aob30_50, aob60plus, aob50_60], asp=[asp=n, asp=y]}
i need generate possible combinations of value pairs. cartesian product example.
[[hhsize4+,aob<30,asp=n], [hhsize4+,aob<30,asp=y], [hhsize4+,aob30_50,asp=n], [hhsize4+,aob30_50,asp=y],
and on.
how can go this?
using guava sets
:
list<set<string>> values = map.values() .stream() .map(hashset::new) // set .collect(collectors.tolist()); set<list<string>> = sets.cartesianproduct(values);
Comments
Post a Comment