followedBy method

  1. @override
Iterable<E> followedBy(
  1. Iterable<E> other
)

Returns the lazy concatentation of this iterable and other.

The returned iterable will provide the same elements as this iterable, and, after that, the elements of other, in the same order as in the original iterables.

If any of other's values already exist in this list, a DuplicateValueError will be thrown if the list is strict, otherwise those values will be removed from other before concatenation.

Implementation

@override
Iterable<E> followedBy(Iterable<E> other) {
  if (strict) {
    for (var value in other) {
      if (_contains(value)) {
        throw DuplicateValueError(value);
      }
    }
  } else {
    other = other.toList()..removeWhere((value) => _contains(value));
  }

  return elements.followedBy(other);
}