public final class IterableExpansionBindings extends java.lang.Object implements Bindings
Bindings which expand an Iterable into multiple variables (given in an Iterable as well).
Each variable is assigned to the value at the same position in the values Iterable.
Note, this doesn't enforce any constraints. In particular the values Iterable can contain more values than the
variables Iterable without any error. In this case the remaining values will remain unbound.
If the variables contain more elements than the values, no error is thrown unless an "unbound" variable is accessed.
This behavior is different from Python where the variables must be equal to the number of values in the expanded iterable.
| Constructor and Description |
|---|
IterableExpansionBindings(java.lang.Iterable<Identifier> identifiers,
java.lang.Iterable<java.lang.Object> values) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isEmpty()
Returns whether these Bindings contain any values.
|
java.lang.Object |
resolve(java.lang.String key)
Returns a value for the given key or
null if no such key exists in these Bindings. |
public IterableExpansionBindings(java.lang.Iterable<Identifier> identifiers, java.lang.Iterable<java.lang.Object> values)
@Nullable
public java.lang.Object resolve(@Nonnull
java.lang.String key)
Bindingsnull if no such key exists in these Bindings.