// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.common.util;

import java.util.function.Supplier;
import java.util.Collections;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import javax.annotation.Nonnull;
import java.util.Map;

public class MapUtil
{
    @Nonnull
    public static <T, V> Map<T, V> combineUnmodifiable(@Nonnull final Map<T, V> one, @Nonnull final Map<T, V> two) {
        final Map<T, V> map = new Object2ObjectOpenHashMap<T, V>();
        map.putAll((Map<? extends T, ? extends V>)one);
        map.putAll((Map<? extends T, ? extends V>)two);
        return Collections.unmodifiableMap((Map<? extends T, ? extends V>)map);
    }
    
    @Nonnull
    public static <T, V, M extends Map<T, V>> Map<T, V> combineUnmodifiable(@Nonnull final Map<T, V> one, @Nonnull final Map<T, V> two, @Nonnull final Supplier<M> supplier) {
        final Map<T, V> map = supplier.get();
        map.putAll((Map<? extends T, ? extends V>)one);
        map.putAll((Map<? extends T, ? extends V>)two);
        return Collections.unmodifiableMap((Map<? extends T, ? extends V>)map);
    }
    
    @Nonnull
    public static <T, V, M extends Map<T, V>> M combine(@Nonnull final Map<T, V> one, @Nonnull final Map<T, V> two, @Nonnull final Supplier<M> supplier) {
        final M map = supplier.get();
        map.putAll((Map<? extends T, ? extends V>)one);
        map.putAll((Map<? extends T, ? extends V>)two);
        return map;
    }
}
