test_class.file: code/src/test/java/com/googlecode/cqengine/index/compound/support/TupleCombinationGeneratorTest.java
test_class.identifier: TupleCombinationGeneratorTest
test_case.body: @Test
      public void testGenerateCombinations_EmptySubList3() {
          List<List<Object>> inputLists = new ArrayList<List<Object>>() {{
              add(Arrays.<Object>asList(1));
              add(Arrays.<Object>asList("bar", "baz"));
              add(Collections.emptyList());
          }};
          List<List<Object>> permutations = TupleCombinationGenerator.generateCombinations(inputLists);
          Assert.assertTrue(permutations.isEmpty());
      }
test_case.class_method_signature: TupleCombinationGeneratorTest.testGenerateCombinations_EmptySubList3()
test_case.full_signature: @Test public void testGenerateCombinations_EmptySubList3()
test_case.identifier: testGenerateCombinations_EmptySubList3
test_case.invocations: add asList add asList add emptyList generateCombinations assertTrue isEmpty
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGenerateCombinations_EmptySubList3()
focal_class.file: code/src/main/java/com/googlecode/cqengine/index/compound/support/TupleCombinationGenerator.java
focal_class.identifier: TupleCombinationGenerator
focal_class.class_method_signature: TupleCombinationGenerator.generateCombinations(List<? extends Iterable<T>> inputLists)
focal_class.full_signature: public static List<List<T>> generateCombinations(List<? extends Iterable<T>> inputLists)
focal_class.identifier: generateCombinations
focal_class.modifiers: public static
focal_class.parameters: (List<? extends Iterable<T>> inputLists)
focal_class.return: List<List<T>>
focal_class.signature: List<List<T>> generateCombinations(List<? extends Iterable<T>> inputLists)
focal_class.class_method_signature: TupleCombinationGenerator.TupleCombinationGenerator()
focal_class.full_signature:   TupleCombinationGenerator()
focal_class.identifier: TupleCombinationGenerator
focal_class.parameters: ()
focal_class.signature:  TupleCombinationGenerator()
focal_method.body: public static <T> List<List<T>> generateCombinations(List<? extends Iterable<T>> inputLists) {
          if (inputLists.isEmpty()) {
              return Collections.emptyList();
          }
          List<List<T>> results = new ArrayList<List<T>>();
          Iterable<T> currentList = inputLists.get(0);
          if (inputLists.size() == 1) {
              for (T object : currentList) {
                  // This is the last list in the input lists supplied - processed first due to eager recursion below.
                  // Add each object in this input list as a single element in its own new LinkedList.
                  // The other branch will subsequently add objects from preceding input lists
                  // to the _start_ of this LinkedList. We use LinkedList to avoid shuffling elements.
                  results.add(new LinkedList<T>(Collections.singleton(object)));
              }
          }
          else {
              // Start processing objects from the first input list supplied,
              // but note that we will call this method recursively before we move on to the next object...
              for (T object : currentList) {
                  // Prepare a tail list of the input lists (the input lists after this first one).
                  // The tail list is actually a _view_ onto the original input lists, (no data is copied)...
                  List<? extends Iterable<T>> tail = inputLists.subList(1, inputLists.size());
                  // Call this method recursively, getting the first objects in the tail lists first...
                  for (List<T> permutations : generateCombinations(tail)) {
                      // Insert the object from the first list at the _start_ of the permutations list...
                      permutations.add(0, object);
                      // As the stack unwinds, we have assembled permutations in the correct order.
                      // Add each permutation to results, to return to the preceding stack frame or to the caller...
                      results.add(permutations);
                  }
              }
          }
          return results;
      }
focal_method.class_method_signature: TupleCombinationGenerator.generateCombinations(List<? extends Iterable<T>> inputLists)
focal_method.full_signature: public static List<List<T>> generateCombinations(List<? extends Iterable<T>> inputLists)
focal_method.identifier: generateCombinations
focal_method.invocations: isEmpty emptyList get size add singleton subList size generateCombinations add add
focal_method.modifiers: public static
focal_method.parameters: (List<? extends Iterable<T>> inputLists)
focal_method.return: List<List<T>>
focal_method.signature: List<List<T>> generateCombinations(List<? extends Iterable<T>> inputLists)