protected final Set < AggregatedGroupMapping > collectAllGroupsFromParams ( Set < K > keys , AggregatedGroupMapping [ ] aggregatedGroupMappings ) { final Builder < AggregatedGroupMapping > groupsBuilder = ImmutableSet . < AggregatedGroupMapping > builder ( ) ; // Add all groups from the keyset for ( K aggregationKey : keys ) { groupsBuilder . add ( aggregationKey . getAggregatedGroup ( ) ) ; } // Add groups from parameters groupsBuilder . add ( aggregatedGroupMappings ) ; return groupsBuilder . build ( ) ; }
and set in query .