Set < List < Fragment > > allFragmentOrders ( ) { Collection < List < EquivalentFragmentSet >> fragmentSetPermutations = Collections2 . permutations ( equivalentFragmentSets ) ; return fragmentSetPermutations . stream ( ) . flatMap ( ConjunctionQuery :: cartesianProduct ) . collect ( toSet ( ) ) ; }
Get all possible orderings of fragments