aboutsummaryrefslogtreecommitdiff
path: root/Mammoth/Couscous/java/util/HashMap.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Mammoth/Couscous/java/util/HashMap.cs')
-rw-r--r--Mammoth/Couscous/java/util/HashMap.cs27
1 files changed, 19 insertions, 8 deletions
diff --git a/Mammoth/Couscous/java/util/HashMap.cs b/Mammoth/Couscous/java/util/HashMap.cs
index 10070fc..13383a8 100644
--- a/Mammoth/Couscous/java/util/HashMap.cs
+++ b/Mammoth/Couscous/java/util/HashMap.cs
@@ -4,29 +4,36 @@ using Mammoth.Couscous.org.zwobble.mammoth.@internal.util;
using Mammoth.Couscous.java.lang;
namespace Mammoth.Couscous.java.util {
- internal class HashMap<TKey, TValue> : Map<TKey, TValue> {
- private readonly IDictionary<TKey, TValue> _dictionary;
+ internal class HashMap<TKey, TValue> : AbstractMap<TKey, TValue> {
+ private readonly Dictionary<TKey, TValue> _dictionary;
internal HashMap() : this(new Dictionary<TKey, TValue>()) {
}
- internal HashMap(IDictionary<TKey, TValue> dictionary) {
+ internal HashMap(Dictionary<TKey, TValue> dictionary) {
_dictionary = dictionary;
}
- public void put(TKey key, TValue value) {
+ internal HashMap(Map<TKey, TValue> map) : this(new Dictionary<TKey, TValue>(map.AsDictionary())) {
+ }
+
+ public override void put(TKey key, TValue value) {
_dictionary[key] = value;
}
- public bool containsKey(TKey key) {
+ public override bool containsKey(TKey key) {
return _dictionary.ContainsKey(key);
}
- public Set<Map__Entry<TKey, TValue>> entrySet() {
+ public override Set<Map__Entry<TKey, TValue>> entrySet() {
return new EntrySet(_dictionary);
}
- public Optional<TValue> _lookup(TKey key) {
+ public override Collection<TValue> values() {
+ return ToJava.CollectionToCollection(_dictionary.Values);
+ }
+
+ public override Optional<TValue> _lookup(TKey key) {
if (_dictionary.ContainsKey(key)) {
return new Some<TValue>(_dictionary[key]);
} else {
@@ -34,7 +41,11 @@ namespace Mammoth.Couscous.java.util {
}
}
- public IDictionary<TKey, TValue> AsDictionary() {
+ public override IDictionary<TKey, TValue> AsDictionary() {
+ return _dictionary;
+ }
+
+ public override System.Collections.IDictionary AsUntypedDictionary() {
return _dictionary;
}