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

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -