hasDuplicates method

bool hasDuplicates(
  1. dynamic predicate(
    1. T
    )
)

Implementation

bool hasDuplicates(dynamic Function(T) predicate) {
  final iteratedOver = <dynamic>{};

  for (final element in this) {
    final value = predicate(element);

    if (iteratedOver.contains(value)) {
      return true;
    }
    iteratedOver.add(value);
  }

  return false;
}