diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-08-29 17:14:11 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-08-29 17:14:11 +0100 |
| commit | 99ed1b53f084322c06975a2183d812db5f257d34 (patch) | |
| tree | 62cf24a19f552003d6d7f24bbc6effcff64cf94c /Mammoth/Couscous | |
| parent | d5d691a5c27b63e65db39f37d47e863843cacd14 (diff) | |
Update java-mammoth to 0.0.4
Diffstat (limited to 'Mammoth/Couscous')
| -rw-r--r-- | Mammoth/Couscous/HorribleHacks.cs | 12 | ||||
| -rw-r--r-- | Mammoth/Couscous/java/util/Optional.cs | 7 | ||||
| -rw-r--r-- | Mammoth/Couscous/mammoth/internal/util/Lists.cs | 8 |
3 files changed, 10 insertions, 17 deletions
diff --git a/Mammoth/Couscous/HorribleHacks.cs b/Mammoth/Couscous/HorribleHacks.cs index c97dc0a..692d5d9 100644 --- a/Mammoth/Couscous/HorribleHacks.cs +++ b/Mammoth/Couscous/HorribleHacks.cs @@ -5,10 +5,6 @@ using System.Linq; namespace Mammoth.Couscous { internal static class HorribleHacks { - internal static bool equals(this char first, int second) { - return first == second; - } - internal static bool equals(this Optional<string> first, Optional<string> second) { return (!first.isPresent() && !second.isPresent()) || (first.isPresent() && second.isPresent() && first.get() == second.get()); } @@ -19,14 +15,6 @@ namespace Mammoth.Couscous { return first.Count == second.Count && first.All(item => second.ContainsKey(item.Key) && second[item.Key] == item.Value); } - internal static bool equals(this NoteType first, NoteType second) { - return first == second; - } - - internal static bool equals(this TokenType first, TokenType second) { - return first == second; - } - internal static string getMessage(this System.Exception exception) { return exception.Message; } diff --git a/Mammoth/Couscous/java/util/Optional.cs b/Mammoth/Couscous/java/util/Optional.cs index b5be056..0f02c89 100644 --- a/Mammoth/Couscous/java/util/Optional.cs +++ b/Mammoth/Couscous/java/util/Optional.cs @@ -15,12 +15,9 @@ namespace Mammoth.Couscous.java.util void ifPresent(Consumer<T> consumer); } - internal class None<T> : Optional<T> { + internal struct None<T> : Optional<T> { internal static readonly None<T> Instance = new None<T>(); - private None() { - } - public bool isPresent() { return false; } @@ -53,7 +50,7 @@ namespace Mammoth.Couscous.java.util } } - internal class Some<T> : Optional<T> { + internal struct Some<T> : Optional<T> { private readonly T _value; internal Some(T value) { diff --git a/Mammoth/Couscous/mammoth/internal/util/Lists.cs b/Mammoth/Couscous/mammoth/internal/util/Lists.cs index 9df31b7..6f1b8be 100644 --- a/Mammoth/Couscous/mammoth/internal/util/Lists.cs +++ b/Mammoth/Couscous/mammoth/internal/util/Lists.cs @@ -48,6 +48,14 @@ namespace Mammoth.Couscous.org.zwobble.mammoth.@internal.util { return ToJava.ListToList(result); } + internal static List<T> eagerConcat<T>(Iterable<T> first, Iterable<T> second, Iterable<T> third) { + var result = FromJava.IterableToEnumerable(first) + .Concat(FromJava.IterableToEnumerable(second)) + .Concat(FromJava.IterableToEnumerable(third)) + .ToList(); + return ToJava.ListToList(result); + } + internal static List<T> orderedBy<T, R>(Iterable<T> iterable, Function<T, R> getKey) { var result = FromJava.IterableToEnumerable(iterable) .OrderBy(getKey.apply) |
