JD2022-TU1/main/tools/framework/JD.Collections/Details/IHashBase.cs

34 lines
No EOL
1.1 KiB
C#

using System.Collections.Generic;
namespace JD.Collections.Details
{
public interface IHashBase<T> : IEnumerable<T>
{
IEqualityComparer<T> Comparer { get; }
int Count { get; }
/// <summary>
/// Get or set the count of items the hash can contain (cannot be less than the current size).
/// </summary>
int Capacity { get; set; }
/// <summary>
/// Enumerates the content of the hash but does not garantee to return elements added after the enumeration started. Garantees to not throw or not cause any threading issue.
/// </summary>
IEnumerable<T> ThreadSafeEnumerate { get; }
T this[T key] { get; }
/// <summary>
/// Make sure current enumerations will crash on next MoveNext().
/// </summary>
void StopEnumerations();
void TrimExcess();
void Clear();
bool Remove(T value);
bool Remove(ILookup<T> lookup, out T removedValue);
bool Contains(T value);
bool TryGetValue(T value, out T result);
bool TryGetValue(ILookup<T> lookup, out T result);
}
}