summary refs log tree commit diff
path: root/crypto/src/util/collections
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/util/collections')
-rw-r--r--crypto/src/util/collections/CollectionUtilities.cs34
-rw-r--r--crypto/src/util/collections/EmptyEnumerable.cs44
-rw-r--r--crypto/src/util/collections/EnumerableProxy.cs35
-rw-r--r--crypto/src/util/collections/HashSet.cs99
-rw-r--r--crypto/src/util/collections/ISet.cs19
-rw-r--r--crypto/src/util/collections/ReadOnlyCollection.cs44
-rw-r--r--crypto/src/util/collections/ReadOnlyDictionary.cs64
-rw-r--r--crypto/src/util/collections/ReadOnlyList.cs5
-rw-r--r--crypto/src/util/collections/ReadOnlySet.cs61
-rw-r--r--crypto/src/util/collections/UnmodifiableDictionary.cs64
-rw-r--r--crypto/src/util/collections/UnmodifiableDictionaryProxy.cs66
-rw-r--r--crypto/src/util/collections/UnmodifiableList.cs67
-rw-r--r--crypto/src/util/collections/UnmodifiableListProxy.cs61
-rw-r--r--crypto/src/util/collections/UnmodifiableSet.cs59
-rw-r--r--crypto/src/util/collections/UnmodifiableSetProxy.cs56
15 files changed, 193 insertions, 585 deletions
diff --git a/crypto/src/util/collections/CollectionUtilities.cs b/crypto/src/util/collections/CollectionUtilities.cs
index 4a42cf19d..41b558130 100644
--- a/crypto/src/util/collections/CollectionUtilities.cs
+++ b/crypto/src/util/collections/CollectionUtilities.cs
@@ -1,5 +1,4 @@
 using System;
-using System.Collections;
 using System.Collections.Generic;
 using System.Text;
 
@@ -7,19 +6,6 @@ namespace Org.BouncyCastle.Utilities.Collections
 {
     public abstract class CollectionUtilities
     {
-        public static void AddRange(IList to, IEnumerable range)
-        {
-            foreach (object o in range)
-            {
-                to.Add(o);
-            }
-        }
-
-        public static void CollectMatches<T>(ICollection<T> matches, ISelector<T> selector, params IStore<T>[] stores)
-        {
-            CollectMatches(matches, selector, stores);
-        }
-
         public static void CollectMatches<T>(ICollection<T> matches, ISelector<T> selector,
             IEnumerable<IStore<T>> stores)
         {
@@ -45,6 +31,12 @@ namespace Org.BouncyCastle.Utilities.Collections
             return new StoreImpl<T>(contents);
         }
 
+        public static T GetValueOrKey<T>(IDictionary<T, T> d, T k)
+            where T : class
+        {
+            return d.TryGetValue(k, out var v) ? v : k;
+        }
+
         public static V GetValueOrNull<K, V>(IDictionary<K, V> d, K k)
             where V : class
         {
@@ -56,14 +48,14 @@ namespace Org.BouncyCastle.Utilities.Collections
             return new EnumerableProxy<T>(e);
         }
 
-        public static IDictionary ReadOnly(IDictionary d)
+        public static ICollection<T> ReadOnly<T>(ICollection<T> c)
         {
-            return new UnmodifiableDictionaryProxy(d);
+            return new ReadOnlyCollectionProxy<T>(c);
         }
 
-        public static IList ReadOnly(IList l)
+        public static IDictionary<K, V> ReadOnly<K, V>(IDictionary<K, V> d)
         {
-            return new UnmodifiableListProxy(l);
+            return new ReadOnlyDictionaryProxy<K, V>(d);
         }
 
         public static IList<T> ReadOnly<T>(IList<T> l)
@@ -71,9 +63,9 @@ namespace Org.BouncyCastle.Utilities.Collections
             return new ReadOnlyListProxy<T>(l);
         }
 
-        public static ISet ReadOnly(ISet s)
+        public static ISet<T> ReadOnly<T>(ISet<T> s)
         {
-            return new UnmodifiableSetProxy(s);
+            return new ReadOnlySetProxy<T>(s);
         }
 
         public static bool Remove<K, V>(IDictionary<K, V> d, K k, out V v)
@@ -85,7 +77,7 @@ namespace Org.BouncyCastle.Utilities.Collections
             return true;
         }
 
-        public static object RequireNext(IEnumerator e)
+        public static T RequireNext<T>(IEnumerator<T> e)
         {
             if (!e.MoveNext())
                 throw new InvalidOperationException();
diff --git a/crypto/src/util/collections/EmptyEnumerable.cs b/crypto/src/util/collections/EmptyEnumerable.cs
deleted file mode 100644
index a61a0789a..000000000
--- a/crypto/src/util/collections/EmptyEnumerable.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using System;
-using System.Collections;
-
-namespace Org.BouncyCastle.Utilities.Collections
-{
-	public sealed class EmptyEnumerable
-		: IEnumerable
-	{
-		public static readonly IEnumerable Instance = new EmptyEnumerable();
-
-		private EmptyEnumerable()
-		{
-		}
-
-		public IEnumerator GetEnumerator()
-		{
-			return EmptyEnumerator.Instance;
-		}
-	}
-
-	public sealed class EmptyEnumerator
-		: IEnumerator
-	{
-		public static readonly IEnumerator Instance = new EmptyEnumerator();
-
-		private EmptyEnumerator()
-		{
-		}
-
-		public bool MoveNext()
-		{
-			return false;
-		}
-
-		public void Reset()
-		{
-		}
-
-		public object Current
-		{
-			get { throw new InvalidOperationException("No elements"); }
-		}
-	}
-}
diff --git a/crypto/src/util/collections/EnumerableProxy.cs b/crypto/src/util/collections/EnumerableProxy.cs
index 36f78d342..1d97b8f22 100644
--- a/crypto/src/util/collections/EnumerableProxy.cs
+++ b/crypto/src/util/collections/EnumerableProxy.cs
@@ -1,50 +1,29 @@
 using System;
-using System.Collections;
 using System.Collections.Generic;
 
 namespace Org.BouncyCastle.Utilities.Collections
 {
-	public sealed class EnumerableProxy
-		: IEnumerable
-	{
-		private readonly IEnumerable inner;
-
-		public EnumerableProxy(
-			IEnumerable inner)
-		{
-			if (inner == null)
-				throw new ArgumentNullException("inner");
-
-			this.inner = inner;
-		}
-
-		public IEnumerator GetEnumerator()
-		{
-			return inner.GetEnumerator();
-		}
-	}
-
 	internal sealed class EnumerableProxy<T>
 		: IEnumerable<T>
 	{
-		private readonly IEnumerable<T> m_inner;
+		private readonly IEnumerable<T> m_target;
 
-		internal EnumerableProxy(IEnumerable<T> inner)
+		internal EnumerableProxy(IEnumerable<T> target)
 		{
-			if (inner == null)
-				throw new ArgumentNullException("inner");
+			if (target == null)
+				throw new ArgumentNullException(nameof(target));
 
-			m_inner = inner;
+			m_target = target;
 		}
 
 		System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
 		{
-			return m_inner.GetEnumerator();
+			return m_target.GetEnumerator();
 		}
 
 		public IEnumerator<T> GetEnumerator()
 		{
-			return m_inner.GetEnumerator();
+			return m_target.GetEnumerator();
 		}
 	}
 }
diff --git a/crypto/src/util/collections/HashSet.cs b/crypto/src/util/collections/HashSet.cs
deleted file mode 100644
index 1facb58e3..000000000
--- a/crypto/src/util/collections/HashSet.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-using System;
-using System.Collections;
-
-namespace Org.BouncyCastle.Utilities.Collections
-{
-	public class HashSet
-		: ISet
-	{
-		private readonly IDictionary impl = Platform.CreateHashtable();
-
-		public HashSet()
-		{
-		}
-
-		public HashSet(IEnumerable s)
-		{
-			foreach (object o in s)
-			{
-				Add(o);
-			}
-		}
-
-		public virtual void Add(object o)
-		{
-			impl[o] = null;
-		}
-
-		public virtual void AddAll(IEnumerable e)
-		{
-			foreach (object o in e)
-			{
-				Add(o);
-			}
-		}
-
-		public virtual void Clear()
-		{
-			impl.Clear();
-		}
-
-		public virtual bool Contains(object o)
-		{
-			return impl.Contains(o);
-		}
-
-		public virtual void CopyTo(Array array, int index)
-		{
-			impl.Keys.CopyTo(array, index);
-		}
-
-		public virtual int Count
-		{
-			get { return impl.Count; }
-		}
-
-		public virtual IEnumerator GetEnumerator()
-		{
-			return impl.Keys.GetEnumerator();
-		}
-
-		public virtual bool IsEmpty
-		{
-			get { return impl.Count == 0; }
-		}
-
-		public virtual bool IsFixedSize
-		{
-			get { return impl.IsFixedSize; }
-		}
-
-		public virtual bool IsReadOnly
-		{
-			get { return impl.IsReadOnly; }
-		}
-
-		public virtual bool IsSynchronized
-		{
-			get { return impl.IsSynchronized; }
-		}
-
-		public virtual void Remove(object o)
-		{
-			impl.Remove(o);
-		}
-
-		public virtual void RemoveAll(IEnumerable e)
-		{
-			foreach (object o in e)
-			{
-				Remove(o);
-			}
-		}
-
-		public virtual object SyncRoot
-		{
-			get { return impl.SyncRoot; }
-		}
-	}
-}
diff --git a/crypto/src/util/collections/ISet.cs b/crypto/src/util/collections/ISet.cs
deleted file mode 100644
index 1f8edba40..000000000
--- a/crypto/src/util/collections/ISet.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Collections;
-
-namespace Org.BouncyCastle.Utilities.Collections
-{
-	public interface ISet
-		: ICollection
-	{
-		void Add(object o);
-		void AddAll(IEnumerable e);
-		void Clear();
-		bool Contains(object o);
-		bool IsEmpty { get; }
-		bool IsFixedSize { get; }
-		bool IsReadOnly { get; }
-		void Remove(object o);
-		void RemoveAll(IEnumerable e);
-	}
-}
diff --git a/crypto/src/util/collections/ReadOnlyCollection.cs b/crypto/src/util/collections/ReadOnlyCollection.cs
new file mode 100644
index 000000000..a44491d0b
--- /dev/null
+++ b/crypto/src/util/collections/ReadOnlyCollection.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+
+namespace Org.BouncyCastle.Utilities.Collections
+{
+    internal abstract class ReadOnlyCollection<T>
+        : ICollection<T>
+    {
+        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+        {
+            return GetEnumerator();
+        }
+
+        public bool IsReadOnly => true;
+
+        public void Add(T item) => throw new NotSupportedException();
+        public void Clear() => throw new NotSupportedException();
+        public bool Remove(T item) => throw new NotSupportedException();
+
+        public abstract bool Contains(T item);
+        public abstract int Count { get; }
+        public abstract void CopyTo(T[] array, int arrayIndex);
+        public abstract IEnumerator<T> GetEnumerator();
+    }
+
+    internal class ReadOnlyCollectionProxy<T>
+        : ReadOnlyCollection<T>
+    {
+        private readonly ICollection<T> m_target;
+
+        internal ReadOnlyCollectionProxy(ICollection<T> target)
+        {
+            if (target == null)
+                throw new ArgumentNullException(nameof(target));
+
+            m_target = target;
+        }
+
+        public override bool Contains(T item) => m_target.Contains(item);
+        public override int Count => m_target.Count;
+        public override void CopyTo(T[] array, int arrayIndex) => m_target.CopyTo(array, arrayIndex);
+        public override IEnumerator<T> GetEnumerator() => m_target.GetEnumerator();
+    }
+}
diff --git a/crypto/src/util/collections/ReadOnlyDictionary.cs b/crypto/src/util/collections/ReadOnlyDictionary.cs
new file mode 100644
index 000000000..f87bcc506
--- /dev/null
+++ b/crypto/src/util/collections/ReadOnlyDictionary.cs
@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+
+namespace Org.BouncyCastle.Utilities.Collections
+{
+    internal abstract class ReadOnlyDictionary<K, V>
+        : IDictionary<K, V>
+    {
+        public V this[K key]
+        {
+            get { return Lookup(key); }
+            set { throw new NotSupportedException(); }
+        }
+
+        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+        {
+            return GetEnumerator();
+        }
+
+        public bool IsReadOnly => true;
+
+        public void Add(K key, V value) => throw new NotSupportedException();
+        public void Add(KeyValuePair<K, V> item) => throw new NotSupportedException();
+        public void Clear() => throw new NotSupportedException();
+        public bool Remove(K key) => throw new NotSupportedException();
+        public bool Remove(KeyValuePair<K, V> item) => throw new NotSupportedException();
+
+        public abstract bool Contains(KeyValuePair<K, V> item);
+        public abstract bool ContainsKey(K key);
+        public abstract void CopyTo(KeyValuePair<K, V>[] array, int arrayIndex);
+        public abstract int Count { get; }
+        public abstract IEnumerator<KeyValuePair<K, V>> GetEnumerator();
+        public abstract ICollection<K> Keys { get; }
+        public abstract bool TryGetValue(K key, out V value);
+        public abstract ICollection<V> Values { get; }
+
+        protected abstract V Lookup(K key);
+    }
+
+    internal class ReadOnlyDictionaryProxy<K, V>
+        : ReadOnlyDictionary<K, V>
+    {
+        private readonly IDictionary<K, V> m_target;
+
+        internal ReadOnlyDictionaryProxy(IDictionary<K, V> target)
+        {
+            if (target == null)
+                throw new ArgumentNullException(nameof(target));
+
+            m_target = target;
+        }
+
+        public override bool Contains(KeyValuePair<K, V> item) => m_target.Contains(item);
+        public override bool ContainsKey(K key) => m_target.ContainsKey(key);
+        public override void CopyTo(KeyValuePair<K, V>[] array, int arrayIndex) => m_target.CopyTo(array, arrayIndex);
+        public override int Count => m_target.Count;
+        public override IEnumerator<KeyValuePair<K, V>> GetEnumerator() => m_target.GetEnumerator();
+        public override ICollection<K> Keys => new ReadOnlyCollectionProxy<K>(m_target.Keys);
+        public override bool TryGetValue(K key, out V value) => m_target.TryGetValue(key, out value);
+        public override ICollection<V> Values => new ReadOnlyCollectionProxy<V>(m_target.Values);
+
+        protected override V Lookup(K key) => m_target[key];
+    }
+}
diff --git a/crypto/src/util/collections/ReadOnlyList.cs b/crypto/src/util/collections/ReadOnlyList.cs
index 707c73bfd..c4d367c47 100644
--- a/crypto/src/util/collections/ReadOnlyList.cs
+++ b/crypto/src/util/collections/ReadOnlyList.cs
@@ -25,10 +25,10 @@ namespace Org.BouncyCastle.Utilities.Collections
         public bool Remove(T item) => throw new NotSupportedException();
         public void RemoveAt(int index) => throw new NotSupportedException();
 
-        public abstract int Count { get; }
 
         public abstract bool Contains(T item);
         public abstract void CopyTo(T[] array, int arrayIndex);
+        public abstract int Count { get; }
         public abstract IEnumerator<T> GetEnumerator();
         public abstract int IndexOf(T item);
 
@@ -42,6 +42,9 @@ namespace Org.BouncyCastle.Utilities.Collections
 
         internal ReadOnlyListProxy(IList<T> target)
         {
+            if (target == null)
+                throw new ArgumentNullException(nameof(target));
+
             m_target = target;
         }
 
diff --git a/crypto/src/util/collections/ReadOnlySet.cs b/crypto/src/util/collections/ReadOnlySet.cs
new file mode 100644
index 000000000..36c198f07
--- /dev/null
+++ b/crypto/src/util/collections/ReadOnlySet.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+
+namespace Org.BouncyCastle.Utilities.Collections
+{
+    internal abstract class ReadOnlySet<T>
+        : ISet<T>
+    {
+        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+        {
+            return GetEnumerator();
+        }
+
+        public bool IsReadOnly => true;
+
+        void ICollection<T>.Add(T item) => throw new NotSupportedException();
+
+        public bool Add(T item) => throw new NotSupportedException();
+        public void Clear() => throw new NotSupportedException();
+        public void ExceptWith(IEnumerable<T> other) => throw new NotSupportedException();
+        public void IntersectWith(IEnumerable<T> other) => throw new NotSupportedException();
+        public bool Remove(T item) => throw new NotSupportedException();
+        public bool SetEquals(IEnumerable<T> other) => throw new NotSupportedException();
+        public void SymmetricExceptWith(IEnumerable<T> other) => throw new NotSupportedException();
+        public void UnionWith(IEnumerable<T> other) => throw new NotSupportedException();
+
+        public abstract bool Contains(T item);
+        public abstract void CopyTo(T[] array, int arrayIndex);
+        public abstract int Count { get; }
+        public abstract IEnumerator<T> GetEnumerator();
+        public abstract bool IsProperSubsetOf(IEnumerable<T> other);
+        public abstract bool IsProperSupersetOf(IEnumerable<T> other);
+        public abstract bool IsSubsetOf(IEnumerable<T> other);
+        public abstract bool IsSupersetOf(IEnumerable<T> other);
+        public abstract bool Overlaps(IEnumerable<T> other);
+    }
+
+    internal class ReadOnlySetProxy<T>
+        : ReadOnlySet<T>
+    {
+        private readonly ISet<T> m_target;
+
+        internal ReadOnlySetProxy(ISet<T> target)
+        {
+            if (target == null)
+                throw new ArgumentNullException(nameof(target));
+
+            m_target = target;
+        }
+
+        public override bool Contains(T item) => m_target.Contains(item);
+        public override void CopyTo(T[] array, int arrayIndex) => m_target.CopyTo(array, arrayIndex);
+        public override int Count => m_target.Count;
+        public override IEnumerator<T> GetEnumerator() => m_target.GetEnumerator();
+        public override bool IsProperSubsetOf(IEnumerable<T> other) => m_target.IsProperSubsetOf(other);
+        public override bool IsProperSupersetOf(IEnumerable<T> other) => m_target.IsProperSupersetOf(other);
+        public override bool IsSubsetOf(IEnumerable<T> other) => m_target.IsSubsetOf(other);
+        public override bool IsSupersetOf(IEnumerable<T> other) => m_target.IsSupersetOf(other);
+        public override bool Overlaps(IEnumerable<T> other) => m_target.Overlaps(other);
+    }
+}
diff --git a/crypto/src/util/collections/UnmodifiableDictionary.cs b/crypto/src/util/collections/UnmodifiableDictionary.cs
deleted file mode 100644
index 3b4ba22ae..000000000
--- a/crypto/src/util/collections/UnmodifiableDictionary.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-using System;
-using System.Collections;
-
-namespace Org.BouncyCastle.Utilities.Collections
-{
-	public abstract class UnmodifiableDictionary
-		: IDictionary
-	{
-		protected UnmodifiableDictionary()
-		{
-		}
-
-		public virtual void Add(object k, object v)
-		{
-			throw new NotSupportedException();
-		}
-
-		public virtual void Clear()
-		{
-			throw new NotSupportedException();
-		}
-
-		public abstract bool Contains(object k);
-
-		public abstract void CopyTo(Array array, int index);
-
-		public abstract int Count { get; }
-
-		System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
-		{
-			return GetEnumerator();
-		}
-
-		public abstract IDictionaryEnumerator GetEnumerator();
-
-		public virtual void Remove(object k)
-		{
-			throw new NotSupportedException();
-		}
-
-		public abstract bool IsFixedSize { get; }
-
-		public virtual bool IsReadOnly
-		{
-			get { return true; }
-		}
-
-		public abstract bool IsSynchronized { get; }
-
-		public abstract object SyncRoot { get; }
-
-		public abstract ICollection Keys { get; }
-
-		public abstract ICollection Values { get; }
-
-		public virtual object this[object k]
-		{
-			get { return GetValue(k); }
-			set { throw new NotSupportedException(); }
-		}
-
-		protected abstract object GetValue(object k);
-	}
-}
diff --git a/crypto/src/util/collections/UnmodifiableDictionaryProxy.cs b/crypto/src/util/collections/UnmodifiableDictionaryProxy.cs
deleted file mode 100644
index 0fca909a3..000000000
--- a/crypto/src/util/collections/UnmodifiableDictionaryProxy.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-using System;
-using System.Collections;
-
-namespace Org.BouncyCastle.Utilities.Collections
-{
-	public class UnmodifiableDictionaryProxy
-		: UnmodifiableDictionary
-	{
-		private readonly IDictionary d;
-
-		public UnmodifiableDictionaryProxy(IDictionary d)
-		{
-			this.d = d;
-		}
-
-		public override bool Contains(object k)
-		{
-			return d.Contains(k);
-		}
-
-		public override void CopyTo(Array array, int index)
-		{
-			d.CopyTo(array, index);
-		}
-
-		public override int Count
-		{
-			get { return d.Count; }
-		}
-
-		public override IDictionaryEnumerator GetEnumerator()
-		{
-			return d.GetEnumerator();
-		}
-
-		public override bool IsFixedSize
-		{
-			get { return d.IsFixedSize; }
-		}
-
-		public override bool IsSynchronized
-		{
-			get { return d.IsSynchronized; }
-		}
-
-		public override object SyncRoot
-		{
-			get { return d.SyncRoot; }
-		}
-
-		public override ICollection Keys
-		{
-			get { return d.Keys; }
-		}
-
-		public override ICollection Values
-		{
-			get { return d.Values; }
-		}
-
-		protected override object GetValue(object k)
-		{
-			return d[k];
-		}
-	}
-}
diff --git a/crypto/src/util/collections/UnmodifiableList.cs b/crypto/src/util/collections/UnmodifiableList.cs
deleted file mode 100644
index 28e49eac3..000000000
--- a/crypto/src/util/collections/UnmodifiableList.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-using System;
-using System.Collections;
-
-namespace Org.BouncyCastle.Utilities.Collections
-{
-	public abstract class UnmodifiableList
-		: IList
-	{
-		protected UnmodifiableList()
-		{
-		}
-
-		public virtual int Add(object o)
-		{
-			throw new NotSupportedException();
-		}
-
-		public virtual void Clear()
-		{
-			throw new NotSupportedException();
-		}
-
-		public abstract bool Contains(object o);
-
-		public abstract void CopyTo(Array array, int index);
-
-		public abstract int Count { get; }
-
-		public abstract IEnumerator GetEnumerator();
-
-		public abstract int IndexOf(object o);
-
-		public virtual void Insert(int i, object o)
-		{
-			throw new NotSupportedException();
-		}
-
-		public abstract bool IsFixedSize { get; }
-
-		public virtual bool IsReadOnly
-		{
-			get { return true; }
-		}
-
-		public abstract bool IsSynchronized { get; }
-
-		public virtual void Remove(object o)
-		{
-			throw new NotSupportedException();
-		}
-
-		public virtual void RemoveAt(int i)
-		{
-			throw new NotSupportedException();
-		}
-
-		public abstract object SyncRoot { get; }
-		
-		public virtual object this[int i]
-		{
-			get { return GetValue(i); }
-			set { throw new NotSupportedException(); }
-		}
-
-		protected abstract object GetValue(int i);
-	}
-}
diff --git a/crypto/src/util/collections/UnmodifiableListProxy.cs b/crypto/src/util/collections/UnmodifiableListProxy.cs
deleted file mode 100644
index 9d00737ef..000000000
--- a/crypto/src/util/collections/UnmodifiableListProxy.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-using System;
-using System.Collections;
-
-namespace Org.BouncyCastle.Utilities.Collections
-{
-	public class UnmodifiableListProxy
-		: UnmodifiableList
-	{
-		private readonly IList l;
-
-		public UnmodifiableListProxy(IList l)
-		{
-			this.l = l;
-		}
-
-		public override bool Contains(object o)
-		{
-			return l.Contains(o);
-		}
-
-		public override void CopyTo(Array array, int index)
-		{
-			l.CopyTo(array, index);
-		}
-
-		public override int Count
-		{
-			get { return l.Count; }
-		}
-
-		public override IEnumerator GetEnumerator()
-		{
-			return l.GetEnumerator();
-		}
-
-		public override int IndexOf(object o)
-		{
-			return l.IndexOf(o);
-		}
-
-		public override bool IsFixedSize
-		{
-			get { return l.IsFixedSize; }
-		}
-
-		public override bool IsSynchronized
-		{
-			get { return l.IsSynchronized; }
-		}
-
-		public override object SyncRoot
-		{
-			get { return l.SyncRoot; }
-		}
-
-		protected override object GetValue(int i)
-		{
-			return l[i];
-		}
-	}
-}
diff --git a/crypto/src/util/collections/UnmodifiableSet.cs b/crypto/src/util/collections/UnmodifiableSet.cs
deleted file mode 100644
index 8792815ac..000000000
--- a/crypto/src/util/collections/UnmodifiableSet.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-using System;
-using System.Collections;
-
-namespace Org.BouncyCastle.Utilities.Collections
-{
-	public abstract class UnmodifiableSet
-		: ISet
-	{
-		protected UnmodifiableSet()
-		{
-		}
-
-		public virtual void Add(object o)
-		{
-			throw new NotSupportedException();
-		}
-
-		public virtual void AddAll(IEnumerable e)
-		{
-			throw new NotSupportedException();
-		}
-
-		public virtual void Clear()
-		{
-			throw new NotSupportedException();
-		}
-		
-		public abstract bool Contains(object o);
-
-		public abstract void CopyTo(Array array, int index);
-
-		public abstract int Count { get; }
-
-		public abstract IEnumerator GetEnumerator();
-
-		public abstract bool IsEmpty { get; }
-
-		public abstract bool IsFixedSize { get; }
-
-		public virtual bool IsReadOnly
-		{
-			get { return true; }
-		}
-
-		public abstract bool IsSynchronized { get; }
-
-		public abstract object SyncRoot { get; }
-
-		public virtual void Remove(object o)
-		{
-			throw new NotSupportedException();
-		}
-
-		public virtual void RemoveAll(IEnumerable e)
-		{
-			throw new NotSupportedException();
-		}
-	}
-}
diff --git a/crypto/src/util/collections/UnmodifiableSetProxy.cs b/crypto/src/util/collections/UnmodifiableSetProxy.cs
deleted file mode 100644
index e119e2957..000000000
--- a/crypto/src/util/collections/UnmodifiableSetProxy.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using System;
-using System.Collections;
-
-namespace Org.BouncyCastle.Utilities.Collections
-{
-	public class UnmodifiableSetProxy
-		: UnmodifiableSet
-	{
-		private readonly ISet s;
-
-		public UnmodifiableSetProxy (ISet s)
-		{
-			this.s = s;
-		}
-
-		public override bool Contains(object o)
-		{
-			return s.Contains(o);
-		}
-
-		public override void CopyTo(Array array, int index)
-		{
-			s.CopyTo(array, index);
-		}
-
-		public override int Count
-		{
-			get { return s.Count; }
-		}
-
-		public override IEnumerator GetEnumerator()
-		{
-			return s.GetEnumerator();
-		}
-
-		public override bool IsEmpty
-		{
-			get { return s.IsEmpty; }
-		}
-
-		public override bool IsFixedSize
-		{
-			get { return s.IsFixedSize; }
-		}
-
-		public override bool IsSynchronized
-		{
-			get { return s.IsSynchronized; }
-		}
-
-		public override object SyncRoot
-		{
-			get { return s.SyncRoot; }
-		}
-	}
-}