summary refs log tree commit diff
path: root/crypto/src/util/collections/CollectionUtilities.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-01-27 01:58:23 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-01-27 01:58:23 +0700
commite71fe27c302d36e6355d9da12f3d9ec51540825a (patch)
tree6aa065f627d14e659e68ae0cbe355b656af3e40f /crypto/src/util/collections/CollectionUtilities.cs
parentAdd CrlID.GetInstance methods, obsolete public constructor (diff)
downloadBouncyCastle.NET-ed25519-e71fe27c302d36e6355d9da12f3d9ec51540825a.tar.xz
Misc. cleanup after bc-fips-csharp updates
Diffstat (limited to 'crypto/src/util/collections/CollectionUtilities.cs')
-rw-r--r--crypto/src/util/collections/CollectionUtilities.cs13
1 files changed, 13 insertions, 0 deletions
diff --git a/crypto/src/util/collections/CollectionUtilities.cs b/crypto/src/util/collections/CollectionUtilities.cs
index 26b3f2a1d..a1fb0e949 100644
--- a/crypto/src/util/collections/CollectionUtilities.cs
+++ b/crypto/src/util/collections/CollectionUtilities.cs
@@ -31,6 +31,19 @@ namespace Org.BouncyCastle.Utilities.Collections
             return new StoreImpl<T>(contents);
         }
 
+        public static T GetFirstOrNull<T>(IEnumerable<T> e)
+            where T : class
+        {
+            if (e != null)
+            {
+                foreach (var t in e)
+                {
+                    return t;
+                }
+            }
+            return null;
+        }
+
         public static T GetValueOrKey<T>(IDictionary<T, T> d, T k)
         {
             return d.TryGetValue(k, out var v) ? v : k;