DATATYPE - Element type@Immutable public final class CombinationGeneratorFlexible<DATATYPE> extends Object
| Constructor and Description |
|---|
CombinationGeneratorFlexible(int nSlotCount,
boolean bAllowEmpty)
Ctor
|
| Modifier and Type | Method and Description |
|---|---|
ICommonsSet<ICommonsList<DATATYPE>> |
getCombinations(ICommonsList<DATATYPE> aElements)
Generate all combinations without duplicates.
|
static <DATATYPE> ICommonsSet<ICommonsList<DATATYPE>> |
getCombinations(ICommonsList<DATATYPE> aElements,
boolean bAllowEmpty) |
static <DATATYPE> void |
iterateAllCombinations(ICommonsList<DATATYPE> aElements,
boolean bAllowEmpty,
Consumer<? super ICommonsList<DATATYPE>> aCallback) |
void |
iterateAllCombinations(ICommonsList<DATATYPE> aElements,
Consumer<? super ICommonsList<DATATYPE>> aCallback)
Iterate all combination, no matter they are unique or not.
|
public CombinationGeneratorFlexible(@Nonnegative int nSlotCount, boolean bAllowEmpty)
nSlotCount - the number of slots to usebAllowEmpty - whether or not to include an empty result set (no slot filled)public void iterateAllCombinations(@Nonnull ICommonsList<DATATYPE> aElements, @Nonnull Consumer<? super ICommonsList<DATATYPE>> aCallback)
aElements - List of elements.aCallback - Callback to invoke@Nonnull @ReturnsMutableCopy public ICommonsSet<ICommonsList<DATATYPE>> getCombinations(@Nonnull ICommonsList<DATATYPE> aElements)
aElements - the elements to distribute to the specified slots (may be empty!)public static <DATATYPE> void iterateAllCombinations(@Nonnull ICommonsList<DATATYPE> aElements, boolean bAllowEmpty, @Nonnull Consumer<? super ICommonsList<DATATYPE>> aCallback)
@Nonnull @ReturnsMutableCopy public static <DATATYPE> ICommonsSet<ICommonsList<DATATYPE>> getCombinations(@Nonnull ICommonsList<DATATYPE> aElements, boolean bAllowEmpty)
Copyright © 2014–2017 Philip Helger. All rights reserved.