@Test public void createGroupListNullDimension() throws Exception { assertEqualGroupList( ImmutableList.of( new ProductFlavorCombo<CoreProductFlavor>(f1) ), ProductFlavorCombo.createCombinations( null, ImmutableList.of(f1))); }
@NonNull public static <S extends DimensionAware & Named> List<ProductFlavorCombo<S>> createCombinations( @Nullable List<String> flavorDimensions, @NonNull Iterable<S> productFlavors) { List <ProductFlavorCombo<S>> result = Lists.newArrayList(); if (flavorDimensions == null || flavorDimensions.isEmpty()) { for (S flavor : productFlavors) { result.add(new ProductFlavorCombo<S>(ImmutableList.of(flavor))); } } else { ArrayListMultimap<String, S> map = ArrayListMultimap.create(); for (S flavor : productFlavors) { String flavorDimension = flavor.getDimension(); if (flavorDimension == null) { throw new RuntimeException(String.format( "Flavor '%1$s' has no flavor dimension.", flavor.getName())); } if (!flavorDimensions.contains(flavorDimension)) { throw new RuntimeException(String.format( "Flavor '%1$s' has unknown dimension '%2$s'.", flavor.getName(), flavor.getDimension())); } map.put(flavorDimension, flavor); } createProductFlavorCombinations(result, Lists.<S>newArrayListWithCapacity(flavorDimensions.size()), 0, flavorDimensions, map); } return result; }
ProductFlavorCombo { @NonNull public static <S extends DimensionAware & Named> List<ProductFlavorCombo<S>> createCombinations( @Nullable List<String> flavorDimensions, @NonNull Iterable<S> productFlavors) { List <ProductFlavorCombo<S>> result = Lists.newArrayList(); if (flavorDimensions == null || flavorDimensions.isEmpty()) { for (S flavor : productFlavors) { result.add(new ProductFlavorCombo<S>(ImmutableList.of(flavor))); } } else { ArrayListMultimap<String, S> map = ArrayListMultimap.create(); for (S flavor : productFlavors) { String flavorDimension = flavor.getDimension(); if (flavorDimension == null) { throw new RuntimeException(String.format( "Flavor '%1$s' has no flavor dimension.", flavor.getName())); } if (!flavorDimensions.contains(flavorDimension)) { throw new RuntimeException(String.format( "Flavor '%1$s' has unknown dimension '%2$s'.", flavor.getName(), flavor.getDimension())); } map.put(flavorDimension, flavor); } createProductFlavorCombinations(result, Lists.<S>newArrayListWithCapacity(flavorDimensions.size()), 0, flavorDimensions, map); } return result; } }
ProductFlavorCombo { @NonNull public static <S extends DimensionAware & Named> List<ProductFlavorCombo<S>> createCombinations( @Nullable List<String> flavorDimensions, @NonNull Iterable<S> productFlavors) { List <ProductFlavorCombo<S>> result = Lists.newArrayList(); if (flavorDimensions == null || flavorDimensions.isEmpty()) { for (S flavor : productFlavors) { result.add(new ProductFlavorCombo<S>(ImmutableList.of(flavor))); } } else { ArrayListMultimap<String, S> map = ArrayListMultimap.create(); for (S flavor : productFlavors) { String flavorDimension = flavor.getDimension(); if (flavorDimension == null) { throw new RuntimeException(String.format( "Flavor '%1$s' has no flavor dimension.", flavor.getName())); } if (!flavorDimensions.contains(flavorDimension)) { throw new RuntimeException(String.format( "Flavor '%1$s' has unknown dimension '%2$s'.", flavor.getName(), flavor.getDimension())); } map.put(flavorDimension, flavor); } createProductFlavorCombinations(result, Lists.<S>newArrayListWithCapacity(flavorDimensions.size()), 0, flavorDimensions, map); } return result; } ProductFlavorCombo(@NonNull T... flavors);  ProductFlavorCombo(@NonNull Iterable<T> flavors); }
ProductFlavorCombo { @NonNull public static <S extends DimensionAware & Named> List<ProductFlavorCombo<S>> createCombinations( @Nullable List<String> flavorDimensions, @NonNull Iterable<S> productFlavors) { List <ProductFlavorCombo<S>> result = Lists.newArrayList(); if (flavorDimensions == null || flavorDimensions.isEmpty()) { for (S flavor : productFlavors) { result.add(new ProductFlavorCombo<S>(ImmutableList.of(flavor))); } } else { ArrayListMultimap<String, S> map = ArrayListMultimap.create(); for (S flavor : productFlavors) { String flavorDimension = flavor.getDimension(); if (flavorDimension == null) { throw new RuntimeException(String.format( "Flavor '%1$s' has no flavor dimension.", flavor.getName())); } if (!flavorDimensions.contains(flavorDimension)) { throw new RuntimeException(String.format( "Flavor '%1$s' has unknown dimension '%2$s'.", flavor.getName(), flavor.getDimension())); } map.put(flavorDimension, flavor); } createProductFlavorCombinations(result, Lists.<S>newArrayListWithCapacity(flavorDimensions.size()), 0, flavorDimensions, map); } return result; } ProductFlavorCombo(@NonNull T... flavors);  ProductFlavorCombo(@NonNull Iterable<T> flavors); @NonNull String getName(); @NonNull List<T> getFlavorList(); @NonNull static List<ProductFlavorCombo<S>> createCombinations(
            @Nullable List<String> flavorDimensions,
            @NonNull Iterable<S> productFlavors); }
ProductFlavorCombo { @NonNull public static <S extends DimensionAware & Named> List<ProductFlavorCombo<S>> createCombinations( @Nullable List<String> flavorDimensions, @NonNull Iterable<S> productFlavors) { List <ProductFlavorCombo<S>> result = Lists.newArrayList(); if (flavorDimensions == null || flavorDimensions.isEmpty()) { for (S flavor : productFlavors) { result.add(new ProductFlavorCombo<S>(ImmutableList.of(flavor))); } } else { ArrayListMultimap<String, S> map = ArrayListMultimap.create(); for (S flavor : productFlavors) { String flavorDimension = flavor.getDimension(); if (flavorDimension == null) { throw new RuntimeException(String.format( "Flavor '%1$s' has no flavor dimension.", flavor.getName())); } if (!flavorDimensions.contains(flavorDimension)) { throw new RuntimeException(String.format( "Flavor '%1$s' has unknown dimension '%2$s'.", flavor.getName(), flavor.getDimension())); } map.put(flavorDimension, flavor); } createProductFlavorCombinations(result, Lists.<S>newArrayListWithCapacity(flavorDimensions.size()), 0, flavorDimensions, map); } return result; } ProductFlavorCombo(@NonNull T... flavors);  ProductFlavorCombo(@NonNull Iterable<T> flavors); @NonNull String getName(); @NonNull List<T> getFlavorList(); @NonNull static List<ProductFlavorCombo<S>> createCombinations(
            @Nullable List<String> flavorDimensions,
            @NonNull Iterable<S> productFlavors);  }