diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-01-21 14:51:32 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-01-21 14:51:32 +0700 |
commit | 31525ff4a76773fa0cc85d4abcee7d5418cbd984 (patch) | |
tree | 0c3fa4c3b580f68c58f1476502fdaa1d25ec44f4 /crypto/src/util/collections/CollectionUtilities.cs | |
parent | Bring Fp field element code mostly up-to-date with Java version (diff) | |
download | BouncyCastle.NET-ed25519-31525ff4a76773fa0cc85d4abcee7d5418cbd984.tar.xz |
Make static utility classes abstract instead of sealed
Add Arrays.GetHashCode for int[] Formatting
Diffstat (limited to '')
-rw-r--r-- | crypto/src/util/collections/CollectionUtilities.cs | 65 |
1 files changed, 29 insertions, 36 deletions
diff --git a/crypto/src/util/collections/CollectionUtilities.cs b/crypto/src/util/collections/CollectionUtilities.cs index fd0bdcc7a..18fcb6774 100644 --- a/crypto/src/util/collections/CollectionUtilities.cs +++ b/crypto/src/util/collections/CollectionUtilities.cs @@ -4,13 +4,9 @@ using System.Text; namespace Org.BouncyCastle.Utilities.Collections { - public sealed class CollectionUtilities - { - private CollectionUtilities() - { - } - - public static void AddRange(IList to, ICollection range) + public abstract class CollectionUtilities + { + public static void AddRange(IList to, IEnumerable range) { foreach (object o in range) { @@ -18,17 +14,15 @@ namespace Org.BouncyCastle.Utilities.Collections } } - public static bool CheckElementsAreOfType( - IEnumerable e, - Type t) - { - foreach (object o in e) - { - if (!t.IsInstanceOfType(o)) - return false; - } - return true; - } + public static bool CheckElementsAreOfType(IEnumerable e, Type t) + { + foreach (object o in e) + { + if (!t.IsInstanceOfType(o)) + return false; + } + return true; + } public static IDictionary ReadOnly(IDictionary d) { @@ -45,27 +39,26 @@ namespace Org.BouncyCastle.Utilities.Collections return new UnmodifiableSetProxy(s); } - public static string ToString( - IEnumerable c) - { - StringBuilder sb = new StringBuilder("["); + public static string ToString(IEnumerable c) + { + StringBuilder sb = new StringBuilder("["); - IEnumerator e = c.GetEnumerator(); + IEnumerator e = c.GetEnumerator(); - if (e.MoveNext()) - { - sb.Append(e.Current.ToString()); + if (e.MoveNext()) + { + sb.Append(e.Current.ToString()); - while (e.MoveNext()) - { - sb.Append(", "); - sb.Append(e.Current.ToString()); - } - } + while (e.MoveNext()) + { + sb.Append(", "); + sb.Append(e.Current.ToString()); + } + } - sb.Append(']'); + sb.Append(']'); - return sb.ToString(); - } - } + return sb.ToString(); + } + } } |