import "copyright.stg"

targetPath() ::= "org/eclipse/collections/impl/map/mutable/primitive"

fileName(primitive) ::= "MutableObject<primitive.name>MapFactoryImpl"

class(primitive) ::= <<
<body(primitive.type, primitive.name)>
>>

body(type, name) ::= <<
<copyright()>

package org.eclipse.collections.impl.map.mutable.primitive;

import org.eclipse.collections.api.block.function.Function;
import org.eclipse.collections.api.block.function.primitive.<name>Function;
import org.eclipse.collections.api.factory.map.primitive.MutableObject<name>MapFactory;
import org.eclipse.collections.api.map.primitive.MutableObject<name>Map;
import org.eclipse.collections.api.map.primitive.Object<name>Map;
import org.eclipse.collections.impl.factory.primitive.Object<name>Maps;
import org.eclipse.collections.impl.utility.Iterate;

/**
 * MutableObject<name>MapFactoryImpl is a factory implementation which creates instances of type {@link MutableObject<name>Map}.
 * This file was automatically generated from template file mutableObjectPrimitiveMapFactoryImpl.stg.
 *
 * @since 6.0.
 */
public enum MutableObject<name>MapFactoryImpl implements MutableObject<name>MapFactory
{
    INSTANCE;

    @Override
    public \<K> MutableObject<name>Map\<K> empty()
    {
        return new Object<name>HashMap(0);
    }

    @Override
    public \<K> MutableObject<name>Map\<K> of()
    {
        return this.empty();
    }

    @Override
    public \<K> MutableObject<name>Map\<K> with()
    {
        return this.empty();
    }

    @Override
    public \<K> MutableObject<name>Map\<K> ofInitialCapacity(int capacity)
    {
        return this.withInitialCapacity(capacity);
    }

    @Override
    public \<K> MutableObject<name>Map\<K> withInitialCapacity(int capacity)
    {
        return new Object<name>HashMap\<>(capacity);
    }

    @Override
    public \<K> MutableObject<name>Map\<K> ofAll(Object<name>Map\<? extends K> map)
    {
        return this.withAll(map);
    }

    @Override
    public \<K> MutableObject<name>Map\<K> withAll(Object<name>Map\<? extends K> map)
    {
        if (map.isEmpty())
        {
            return this.empty();
        }
        return new Object<name>HashMap\<>(map);
    }

    @Override
    public \<T, K> MutableObject<name>Map\<K> from(Iterable\<T> iterable, Function\<? super T, ? extends K> keyFunction, <name>Function\<? super T> valueFunction)
    {
        MutableObject<name>Map\<K> map = Object<name>Maps.mutable.empty();
        Iterate.forEach(iterable, each -> map.put(keyFunction.valueOf(each), valueFunction.<type>ValueOf(each)));
        return map;
    }
}

>>
