summary refs log tree commit diff
path: root/crypto/src/util/collections/StoreImpl.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/util/collections/StoreImpl.cs')
-rw-r--r--crypto/src/util/collections/StoreImpl.cs25
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;
+            }
+        }
+    }
+}