operator + method
Returns a new lazy Iterable that appends the given elements iterable to this iterable.
The returned Iterable lazily yields all elements of this iterable first,
followed by all elements of the elements iterable. This method allows for
efficient concatenation of two iterables without eagerly evaluating them.
-
Parameters:
elements: The iterable of elements to append to this iterable.
-
Returns: A new lazy Iterable that contains all elements of this iterable, followed by all elements of the
elementsiterable. -
Examples:
List<int> firstList = [1, 2, 3]; List<int> secondList = [4, 5, 6]; Iterable<int> concatenated = firstList + secondList; Iterable<int> concatenated = firstList.append(secondList); print(concatenated.toList()); // [1, 2, 3, 4, 5, 6]
Implementation
List<T> operator +(Iterable<T> elements) => append(elements).toList();