mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
31 lines
658 B
C#
31 lines
658 B
C#
|
using System.Collections.Generic;
|
|||
|
|
|||
|
namespace Wabbajack.Common
|
|||
|
{
|
|||
|
public class ConcurrentHashSet<T> where T : notnull
|
|||
|
{
|
|||
|
private Dictionary<T, bool> _inner;
|
|||
|
|
|||
|
public ConcurrentHashSet()
|
|||
|
{
|
|||
|
_inner = new Dictionary<T, bool>();
|
|||
|
}
|
|||
|
public ConcurrentHashSet(IEnumerable<T> input)
|
|||
|
{
|
|||
|
_inner = new Dictionary<T, bool>();
|
|||
|
foreach (var itm in input)
|
|||
|
Add(itm);
|
|||
|
}
|
|||
|
|
|||
|
public bool Contains(T key)
|
|||
|
{
|
|||
|
return _inner.ContainsKey(key);
|
|||
|
}
|
|||
|
|
|||
|
public void Add(T key)
|
|||
|
{
|
|||
|
_inner[key] = true;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|