diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-26 19:34:14 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-26 19:34:14 +0700 |
commit | c8bba37510f01f116fea99204e934d35863a9d2b (patch) | |
tree | 799f39da3e8b2dc53a94b4f5e735626a83c8f7ef /crypto/src/util/collections/StoreImpl.cs | |
parent | Reorganize test vector tests (diff) | |
download | BouncyCastle.NET-ed25519-c8bba37510f01f116fea99204e934d35863a9d2b.tar.xz |
Add store/selector API
Diffstat (limited to '')
-rw-r--r-- | crypto/src/util/collections/StoreImpl.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/crypto/src/util/collections/StoreImpl.cs b/crypto/src/util/collections/StoreImpl.cs new file mode 100644 index 000000000..3a7135007 --- /dev/null +++ b/crypto/src/util/collections/StoreImpl.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace Org.BouncyCastle.Utilities.Collections +{ + internal sealed class StoreImpl<T> + : IStore<T> + { + private readonly List<T> m_contents; + + internal StoreImpl(IEnumerable<T> e) + { + m_contents = new List<T>(e); + } + + IEnumerable<T> IStore<T>.EnumerateMatches(ISelector<T> selector) + { + foreach (T candidate in m_contents) + { + if (selector == null || selector.Match(candidate)) + yield return candidate; + } + } + } +} |