internal GroupEnumerator(LocalList <T> list, Func <T, TKey> keySelector, EqualityComparer <TKey> comparer) { var values = new LocalList <Row <TKey, T> >(list.Length); var uniqueKeys = new LocalList <TKey>(); for (var i = 0; i < list.Length; i++) { var element = list.Get(i); var key = keySelector(element); values.Add(new Row <TKey, T>(key, element)); if (!uniqueKeys.Contains(key, comparer)) { uniqueKeys.Add(key); } } _comparer = comparer; _current = default; _position = 0; _values = values; _uniqueKeys = uniqueKeys; }