From 45e530dceda42282fae56b4c4f5fa7865f57899d Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 4 Jun 2016 16:03:56 +0100 Subject: Remove dotnet (use submodule from dotnet repo instead) --- .../Mammoth/Couscous/mammoth/internal/util/Maps.cs | 110 --------------------- 1 file changed, 110 deletions(-) delete mode 100644 dotnet/Mammoth/Couscous/mammoth/internal/util/Maps.cs (limited to 'dotnet/Mammoth/Couscous/mammoth/internal/util/Maps.cs') diff --git a/dotnet/Mammoth/Couscous/mammoth/internal/util/Maps.cs b/dotnet/Mammoth/Couscous/mammoth/internal/util/Maps.cs deleted file mode 100644 index bee2dac..0000000 --- a/dotnet/Mammoth/Couscous/mammoth/internal/util/Maps.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System.Linq; -using Mammoth.Couscous.java.util; -using Mammoth.Couscous.java.lang; -using Mammoth.Couscous.java.util.function; -using Mammoth.Couscous; - -namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.util -{ - internal static class Maps - { - internal static Map map() { - return ToJava.DictionaryToMap(new System.Collections.Generic.Dictionary()); - } - - internal static Map map(K key1, V value1) { - return ToJava.DictionaryToMap(new System.Collections.Generic.Dictionary { - {key1, value1} - }); - } - - internal static Map map(K key1, V value1, K key2, V value2) { - return ToJava.DictionaryToMap(new System.Collections.Generic.Dictionary { - {key1, value1}, - {key2, value2} - }); - } - - internal static Map toMap(Iterable iterable, Function> function) { - var dictionary = FromJava.IterableToEnumerable(iterable) - .Select(function.apply) - .ToDictionary(entry => entry.getKey(), entry => entry.getValue()); - return ToJava.DictionaryToMap(dictionary); - - } - - internal static Map toMapWithKey(Iterable iterable, Function function) { - var dictionary = FromJava.IterableToEnumerable(iterable) - .ToDictionary(function.apply); - return ToJava.DictionaryToMap(dictionary); - } - - internal static Map> toMultiMapWithKey(Iterable iterable, Function function) { - var dictionary = FromJava.IterableToEnumerable(iterable) - .GroupBy(value => function.apply(value)) - .ToDictionary( - grouping => grouping.Key, - grouping => ToJava.ListToList(grouping.ToList())); - return ToJava.DictionaryToMap(dictionary); - } - - internal static Optional lookup(Map map, K key) { - return map._lookup(key); - } - - internal static Map eagerMapKeys(Map map, Function function) { - var dictionary = FromJava.MapToDictionary(map) - .ToDictionary( - entry => function.apply(entry.Key), - entry => entry.Value); - return ToJava.DictionaryToMap(dictionary); - } - - internal static Map eagerMapValues(Map map, Function function) { - var dictionary = FromJava.MapToDictionary(map) - .ToDictionary( - entry => entry.Key, - entry => function.apply(entry.Value)); - return ToJava.DictionaryToMap(dictionary); - } - - internal static Map__Entry entry(K key, V value) { - return new Entry(key, value); - } - - private class Entry : Map__Entry { - private readonly K _key; - private readonly V _value; - - internal Entry(K key, V value) { - this._key = key; - this._value = value; - } - - public K getKey() { - return _key; - } - - public V getValue() { - return _value; - } - } - - internal static Builder builder() { - return new Builder(); - } - - internal class Builder { - private readonly System.Collections.Generic.IDictionary _values = new System.Collections.Generic.Dictionary(); - - internal Builder put(K key, V value) { - _values[key] = value; - return this; - } - - internal Map build() { - return ToJava.DictionaryToMap(_values); - } - } - } -} -- cgit v1.2.3