ISet<T>.withConfig constructor

ISet<T>.withConfig(
  1. Iterable<T>? iterable,
  2. ConfigSet config
)

Create an ISet from any Iterable and a ConfigSet. Fast, if the Iterable is another ISet. If iterable is null, return an empty ISet.

Implementation

factory ISet.withConfig(
  Iterable<T>? iterable,
  ConfigSet config,
) {
  return ((iterable is ISet<T>) && (iterable.isOfExactGenericType(T)))
      ? (config == iterable.config)
          ? iterable
          : iterable.isEmpty
              ? ISetImpl.empty<T>(config)
              : ISetImpl<T>._(iterable, config: config)
      : (iterable == null)
          ? ISetImpl.empty<T>(config)
          : ISetImpl<T>._unsafe(SFlat<T>(iterable, config: config), config: config);
}