public static <K,V> LinkedHashMap<K,V> asMap(final Object... elements) {
        final LinkedHashMap<K,V> map = new LinkedHashMap<>();
        for (int i = 0; i < elements.length; i+=2) {
            final K k = (K) elements[i];
            final V v = (V) (i+1 < elements.length ? elements[i+1] : null);
            map.put(k, v);
        }
        return map;
    }
Converts varargs to a {@code Map} where the elements are key/value pairs.
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/CollectionUtil.java