From 4f8ad8f0588564679cb8ccb9ae4592738810d800 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 3 Jan 2016 14:36:59 +0000 Subject: Add map as shorter alias for ImmutableMap.of --- src/main/java/org/zwobble/mammoth/util/MammothMaps.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/main/java/org/zwobble/mammoth/util/MammothMaps.java') diff --git a/src/main/java/org/zwobble/mammoth/util/MammothMaps.java b/src/main/java/org/zwobble/mammoth/util/MammothMaps.java index 6e988dd..782bd91 100644 --- a/src/main/java/org/zwobble/mammoth/util/MammothMaps.java +++ b/src/main/java/org/zwobble/mammoth/util/MammothMaps.java @@ -6,6 +6,22 @@ import java.util.Map; import java.util.function.Function; public class MammothMaps { + public static Map map() { + return ImmutableMap.of(); + } + + public static Map map(K key1, V value1) { + return ImmutableMap.of(key1, value1); + } + + public static Map map(K key1, V value1, K key2, V value2) { + return ImmutableMap.of(key1, value1, key2, value2); + } + + public static Map map(K key1, V value1, K key2, V value2, K key3, V value3) { + return ImmutableMap.of(key1, value1, key2, value2, key3, value3); + } + public static Map toMap(Iterable iterable, Function> function) { ImmutableMap.Builder builder = ImmutableMap.builder(); for (T element : iterable) { -- cgit v1.2.3