From 0f9ef005f063198ea2e16ca36beaead4bd5e3824 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 14 Apr 2016 21:12:07 +0100 Subject: Add .NET output --- dotnet/Mammoth/Couscous/java/util/HashSet.cs | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 dotnet/Mammoth/Couscous/java/util/HashSet.cs (limited to 'dotnet/Mammoth/Couscous/java/util/HashSet.cs') diff --git a/dotnet/Mammoth/Couscous/java/util/HashSet.cs b/dotnet/Mammoth/Couscous/java/util/HashSet.cs new file mode 100644 index 0000000..ac10075 --- /dev/null +++ b/dotnet/Mammoth/Couscous/java/util/HashSet.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; + +namespace Mammoth.Couscous.java.util { + internal class HashSet : Set { + private readonly ISet _set; + + internal HashSet() : this(new System.Collections.Generic.HashSet()) { + } + + internal HashSet(ISet set) { + _set = set; + } + + public Iterator iterator() { + return ToJava.EnumeratorToIterator(_set.GetEnumerator()); + } + + public bool isEmpty() { + return _set.Count == 0; + } + + public int size() { + return _set.Count; + } + + public bool contains(object value) { + return value is T && _set.Contains((T)value); + } + + public void add(T value) { + _set.Add(value); + } + } +} -- cgit v1.2.3