import "copyright.stg"

skipBoolean() ::= "true"

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

fileName(primitive) ::= "Mutable<primitive.name>ObjectMapFactoryImpl"

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.Mutable<name>ObjectMapFactory;
import org.eclipse.collections.api.map.primitive.Mutable<name>ObjectMap;
import org.eclipse.collections.api.map.primitive.<name>ObjectMap;
import org.eclipse.collections.impl.factory.primitive.<name>ObjectMaps;
import org.eclipse.collections.impl.utility.Iterate;

/**
 * Mutable<name>ObjectMapFactoryImpl is a factory implementation which creates instances of type {@link Mutable<name>ObjectMap}.
 * This file was automatically generated from template file mutablePrimitiveObjectMapFactoryImpl.stg.
 *
 * @since 6.0.
 */
public enum Mutable<name>ObjectMapFactoryImpl implements Mutable<name>ObjectMapFactory
{
    INSTANCE;

    @Override
    public \<V> Mutable<name>ObjectMap\<V> empty()
    {
        return new <name>ObjectHashMap(0);
    }

    @Override
    public \<V> Mutable<name>ObjectMap\<V> of()
    {
        return this.empty();
    }

    @Override
    public \<V> Mutable<name>ObjectMap\<V> with()
    {
        return this.empty();
    }

    @Override
    public \<V> Mutable<name>ObjectMap\<V> ofInitialCapacity(int capacity)
    {
        return this.withInitialCapacity(capacity);
    }

    @Override
    public \<V> Mutable<name>ObjectMap\<V> withInitialCapacity(int capacity)
    {
        return new <name>ObjectHashMap\<>(capacity);
    }

    @Override
    public \<V> Mutable<name>ObjectMap\<V> ofAll(<name>ObjectMap\<? extends V> map)
    {
        return this.withAll(map);
    }

    @Override
    public \<V> Mutable<name>ObjectMap\<V> withAll(<name>ObjectMap\<? extends V> map)
    {
        if (map.isEmpty())
        {
            return this.empty();
        }
        return new <name>ObjectHashMap\<>(map);
    }

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

>>
