operator + method
Returns the concatenation of this list and other
.
Returns a new list containing the elements of this list followed by
the elements of other
.
The returned list will have the same strict and nullable values
as this
list.
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
UniqueList<E> operator +(List<E> other) {
if (strict) {
for (var value in other) {
if (_contains(value)) {
throw DuplicateValueError(value);
}
}
} else {
other.removeWhere((value) => _contains(value));
}
return UniqueList<E>._(elements + other,
nullable: nullable, strict: strict, growable: growable);
}