Compositions<T> class

A pseudo-list of Compositions (combinations with repetition).

A pseudo-list "containing" all the r-Compositions of objects taken from the list items.

Example

final s = Compositions(3, characters("abcd"));
print("There are ${s.length} 3-Compositions of the objects");
print("in ${s.items}.");
print("The first selection is ${c[0]}.");
Inheritance

Constructors

Compositions(int r, List<T> items)

Properties

hashCode int
The hash code for this object.
no setterinherited
items List<T>
The list from which the objects are selected
no setteroverride
iterable Iterable
An Iterable object that "contains" all the arrangements.
no setterinherited
length BigInt
The number of arrangements "contained" in this pseudo-list.
no setteroverride
r int
The number of items taken from items.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call([Object? fromTo, Object? to]) Iterable<List<T>>
inherited
contains(List<T> x) bool
Returns whether x is in the pseudo-list.
override
indexOf(List<T> selection, [BigInt? start]) BigInt
Returns the index of selection in the list of arranged Compositions.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
range(Object fromTo, [Object? to]) Iterable<List<T>>
Returns a range of arrangements.
inherited
sample(int n, {int? seed, bool withReplacement = false}) Iterable
Generates a random sample of arrangements from this pseudo-list.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](Object k) List<T>
The kth arrangement.
override