cloneSet<E> method

  1. @override
Set<E> cloneSet<E>(
  1. Set<E> source
)
override

Return a deep-cloned Set.

Preserves the concrete Set implementation (e.g. LinkedHashSet, HashSet, UnmodifiableSetView). When doTypedClone is true the returned set preserves element types and performs typed cloning of elements. Typed cloning will throw UnsupportedTypedCloneException if a nested Map is encountered.

Implementation

@override
Set<E> cloneSet<E>(Set<E> source) {
  if (_nestIndex++ > nestLimit) {
    throw LimitExceededException('Nest', _nestIndex);
  }
  final cloned = super.cloneSet<E>(source);
  _nestIndex--;
  return cloned;
}