All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.collections.impl.map.immutable.primitive.ImmutableCharObjectHashMap Maven / Gradle / Ivy

Go to download

Builds the commons-text. Requires eclipse-collections-api be built first and be excluded from any other poms requiring it.

There is a newer version: 11.1.0-r13
Show newest version
/*
 * Copyright (c) 2022 Goldman Sachs and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * and Eclipse Distribution License v. 1.0 which accompany this distribution.
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 * and the Eclipse Distribution License is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 */

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

import java.io.Serializable;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.Map;
import java.util.Optional;

import org.eclipse.collections.api.CharIterable;
import org.eclipse.collections.api.LazyCharIterable;
import org.eclipse.collections.api.LazyIterable;
import org.eclipse.collections.api.RichIterable;
import org.eclipse.collections.api.bag.ImmutableBag;
import org.eclipse.collections.api.bag.MutableBag;
import org.eclipse.collections.api.bag.primitive.ImmutableBooleanBag;
import org.eclipse.collections.api.bag.primitive.ImmutableByteBag;
import org.eclipse.collections.api.bag.primitive.ImmutableCharBag;
import org.eclipse.collections.api.bag.primitive.ImmutableDoubleBag;
import org.eclipse.collections.api.bag.primitive.ImmutableFloatBag;
import org.eclipse.collections.api.bag.primitive.ImmutableIntBag;
import org.eclipse.collections.api.bag.primitive.ImmutableLongBag;
import org.eclipse.collections.api.bag.primitive.ImmutableShortBag;
import org.eclipse.collections.api.bag.sorted.MutableSortedBag;
import org.eclipse.collections.api.bimap.MutableBiMap;
import org.eclipse.collections.api.block.function.Function;
import org.eclipse.collections.api.block.function.Function0;
import org.eclipse.collections.api.block.function.Function2;
import org.eclipse.collections.api.block.function.primitive.BooleanFunction;
import org.eclipse.collections.api.block.function.primitive.ByteFunction;
import org.eclipse.collections.api.block.function.primitive.CharFunction;
import org.eclipse.collections.api.block.function.primitive.DoubleFunction;
import org.eclipse.collections.api.block.function.primitive.DoubleObjectToDoubleFunction;
import org.eclipse.collections.api.block.function.primitive.FloatFunction;
import org.eclipse.collections.api.block.function.primitive.FloatObjectToFloatFunction;
import org.eclipse.collections.api.block.function.primitive.IntFunction;
import org.eclipse.collections.api.block.function.primitive.IntObjectToIntFunction;
import org.eclipse.collections.api.block.function.primitive.LongFunction;
import org.eclipse.collections.api.block.function.primitive.LongObjectToLongFunction;
import org.eclipse.collections.api.block.function.primitive.ShortFunction;
import org.eclipse.collections.api.block.predicate.Predicate;
import org.eclipse.collections.api.block.predicate.Predicate2;
import org.eclipse.collections.api.block.predicate.primitive.CharObjectPredicate;
import org.eclipse.collections.api.block.procedure.Procedure;
import org.eclipse.collections.api.block.procedure.Procedure2;
import org.eclipse.collections.api.block.procedure.primitive.CharObjectProcedure;
import org.eclipse.collections.api.block.procedure.primitive.CharProcedure;
import org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure;
import org.eclipse.collections.api.collection.primitive.MutableBooleanCollection;
import org.eclipse.collections.api.collection.primitive.MutableByteCollection;
import org.eclipse.collections.api.collection.primitive.MutableCharCollection;
import org.eclipse.collections.api.collection.primitive.MutableDoubleCollection;
import org.eclipse.collections.api.collection.primitive.MutableFloatCollection;
import org.eclipse.collections.api.collection.primitive.MutableIntCollection;
import org.eclipse.collections.api.collection.primitive.MutableLongCollection;
import org.eclipse.collections.api.collection.primitive.MutableShortCollection;
import org.eclipse.collections.api.iterator.CharIterator;
import org.eclipse.collections.api.list.MutableList;
import org.eclipse.collections.api.map.ImmutableMap;
import org.eclipse.collections.api.map.MutableMap;
import org.eclipse.collections.api.map.MutableMapIterable;
import org.eclipse.collections.api.map.primitive.CharObjectMap;
import org.eclipse.collections.api.map.primitive.ImmutableCharObjectMap;
import org.eclipse.collections.api.map.primitive.ImmutableObjectCharMap;
import org.eclipse.collections.api.map.primitive.MutableCharObjectMap;
import org.eclipse.collections.api.map.primitive.MutableObjectCharMap;
import org.eclipse.collections.api.map.sorted.MutableSortedMap;
import org.eclipse.collections.api.multimap.MutableMultimap;
import org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap;
import org.eclipse.collections.api.multimap.bag.MutableBagMultimap;
import org.eclipse.collections.api.partition.bag.PartitionImmutableBag;
import org.eclipse.collections.api.set.ImmutableSet;
import org.eclipse.collections.api.set.MutableSet;
import org.eclipse.collections.api.set.primitive.MutableCharSet;
import org.eclipse.collections.api.set.sorted.MutableSortedSet;
import org.eclipse.collections.api.tuple.Pair;
import org.eclipse.collections.api.tuple.primitive.CharObjectPair;
import org.eclipse.collections.impl.UnmodifiableIteratorAdapter;
import org.eclipse.collections.impl.collection.mutable.UnmodifiableMutableCollection;
import org.eclipse.collections.impl.map.mutable.primitive.CharObjectHashMap;
import org.eclipse.collections.impl.factory.primitive.ObjectCharMaps;
import org.eclipse.collections.impl.set.mutable.primitive.UnmodifiableCharSet;

/**
 * ImmutableCharObjectHashMap is the non-modifiable equivalent of {@link CharObjectHashMap}.
 * This file was automatically generated from template file immutablePrimitiveObjectHashMap.stg.
 *
 * @since 4.0.
 */
final class ImmutableCharObjectHashMap extends AbstractImmutableCharObjectMap implements Serializable
{
    private static final long serialVersionUID = 1L;
    private final MutableCharObjectMap delegate;

    ImmutableCharObjectHashMap(CharObjectMap delegate)
    {
        this.delegate = new CharObjectHashMap<>(delegate);
    }

    @Override
    public V get(char key)
    {
        return this.delegate.get(key);
    }

    @Override
    public V getIfAbsent(char key, Function0 ifAbsent)
    {
        return this.delegate.getIfAbsent(key, ifAbsent);
    }

    @Override
    public boolean containsKey(char key)
    {
        return this.delegate.containsKey(key);
    }

    @Override
    public boolean containsValue(Object value)
    {
        return this.delegate.containsValue(value);
    }

    @Override
    public ImmutableCharObjectMap tap(Procedure procedure)
    {
        this.forEach(procedure);
        return this;
    }

    @Override
    public void forEachValue(Procedure procedure)
    {
        this.delegate.forEachValue(procedure);
    }

    @Override
    public void forEachKey(CharProcedure procedure)
    {
        this.delegate.forEachKey(procedure);
    }

    @Override
    public void forEachKeyValue(CharObjectProcedure procedure)
    {
        this.delegate.forEachKeyValue(procedure);
    }

    @Override
    public ImmutableCharObjectMap select(CharObjectPredicate predicate)
    {
        return this.delegate.select(predicate).toImmutable();
    }

    @Override
    public ImmutableCharObjectMap reject(CharObjectPredicate predicate)
    {
        return this.delegate.reject(predicate).toImmutable();
    }

    @Override
    public ImmutableCharObjectMap toImmutable()
    {
        return this;
    }

    @Override
    public int size()
    {
        return this.delegate.size();
    }

    @Override
    public boolean isEmpty()
    {
        return this.delegate.isEmpty();
    }

    @Override
    public boolean notEmpty()
    {
        return this.delegate.notEmpty();
    }

    @Override
    public V getFirst()
    {
        return this.delegate.getFirst();
    }

    @Override
    public V getLast()
    {
        return this.delegate.getLast();
    }

    @Override
    public V getOnly()
    {
        return this.delegate.getOnly();
    }

    @Override
    public boolean contains(Object object)
    {
        return this.delegate.contains(object);
    }

    @Override
    public boolean containsAllIterable(Iterable source)
    {
        return this.delegate.containsAllIterable(source);
    }

    @Override
    public boolean containsAll(Collection source)
    {
        return this.delegate.containsAll(source);
    }

    @Override
    public boolean containsAllArguments(Object... elements)
    {
        return this.delegate.containsAllArguments(elements);
    }

    @Override
    public ImmutableBag select(Predicate predicate)
    {
        return this.delegate.select(predicate).toImmutable();
    }

    @Override
    public > R select(Predicate predicate, R target)
    {
        return this.delegate.select(predicate, target);
    }

    @Override
    public 

ImmutableBag selectWith(Predicate2 predicate, P parameter) { return this.delegate.selectWith(predicate, parameter).toImmutable(); } @Override public > R selectWith(Predicate2 predicate, P parameter, R target) { return this.delegate.selectWith(predicate, parameter, target); } @Override public ImmutableBag reject(Predicate predicate) { return this.delegate.reject(predicate).toImmutable(); } @Override public > R reject(Predicate predicate, R target) { return this.delegate.reject(predicate, target); } @Override public

ImmutableBag rejectWith(Predicate2 predicate, P parameter) { return this.delegate.rejectWith(predicate, parameter).toImmutable(); } @Override public > R rejectWith(Predicate2 predicate, P parameter, R target) { return this.delegate.rejectWith(predicate, parameter, target); } @Override public PartitionImmutableBag partition(Predicate predicate) { return this.delegate.partition(predicate).toImmutable(); } @Override public

PartitionImmutableBag partitionWith(Predicate2 predicate, P parameter) { return this.delegate.partitionWith(predicate, parameter).toImmutable(); } @Override public ImmutableBag selectInstancesOf(Class clazz) { return this.delegate.selectInstancesOf(clazz).toImmutable(); } @Override public ImmutableBag collect(Function function) { MutableBag bag = this.delegate.collect(function); return bag.toImmutable(); } @Override public ImmutableBooleanBag collectBoolean(BooleanFunction booleanFunction) { return this.delegate.collectBoolean(booleanFunction).toImmutable(); } @Override public R collectBoolean(BooleanFunction booleanFunction, R target) { return this.delegate.collectBoolean(booleanFunction, target); } @Override public ImmutableByteBag collectByte(ByteFunction byteFunction) { return this.delegate.collectByte(byteFunction).toImmutable(); } @Override public R collectByte(ByteFunction byteFunction, R target) { return this.delegate.collectByte(byteFunction, target); } @Override public ImmutableCharBag collectChar(CharFunction charFunction) { return this.delegate.collectChar(charFunction).toImmutable(); } @Override public R collectChar(CharFunction charFunction, R target) { return this.delegate.collectChar(charFunction, target); } @Override public ImmutableDoubleBag collectDouble(DoubleFunction doubleFunction) { return this.delegate.collectDouble(doubleFunction).toImmutable(); } @Override public R collectDouble(DoubleFunction doubleFunction, R target) { return this.delegate.collectDouble(doubleFunction, target); } @Override public ImmutableFloatBag collectFloat(FloatFunction floatFunction) { return this.delegate.collectFloat(floatFunction).toImmutable(); } @Override public R collectFloat(FloatFunction floatFunction, R target) { return this.delegate.collectFloat(floatFunction, target); } @Override public ImmutableIntBag collectInt(IntFunction intFunction) { return this.delegate.collectInt(intFunction).toImmutable(); } @Override public R collectInt(IntFunction intFunction, R target) { return this.delegate.collectInt(intFunction, target); } @Override public ImmutableLongBag collectLong(LongFunction longFunction) { return this.delegate.collectLong(longFunction).toImmutable(); } @Override public R collectLong(LongFunction longFunction, R target) { return this.delegate.collectLong(longFunction, target); } @Override public ImmutableShortBag collectShort(ShortFunction shortFunction) { return this.delegate.collectShort(shortFunction).toImmutable(); } @Override public R collectShort(ShortFunction shortFunction, R target) { return this.delegate.collectShort(shortFunction, target); } @Override public ImmutableBag collectWith(Function2 function, P parameter) { MutableBag bag = this.delegate.collectWith(function, parameter); return bag.toImmutable(); } @Override public ImmutableBag collectIf(Predicate predicate, Function function) { MutableBag bag = this.delegate.collectIf(predicate, function); return bag.toImmutable(); } @Override public ImmutableBag flatCollect(Function> function) { return this.delegate.flatCollect(function).toImmutable(); } @Override public V detect(Predicate predicate) { return this.delegate.detect(predicate); } @Override public

V detectWith(Predicate2 predicate, P parameter) { return this.delegate.detectWith(predicate, parameter); } @Override public Optional detectOptional(Predicate predicate) { return this.delegate.detectOptional(predicate); } @Override public

Optional detectWithOptional(Predicate2 predicate, P parameter) { return this.delegate.detectWithOptional(predicate, parameter); } @Override public V detectIfNone(Predicate predicate, Function0 function) { return this.delegate.detectIfNone(predicate, function); } @Override public

V detectWithIfNone(Predicate2 predicate, P parameter, Function0 function) { return this.delegate.detectWithIfNone(predicate, parameter, function); } @Override public int count(Predicate predicate) { return this.delegate.count(predicate); } @Override public

int countWith(Predicate2 predicate, P parameter) { return this.delegate.countWith(predicate, parameter); } @Override public boolean anySatisfy(Predicate predicate) { return this.delegate.anySatisfy(predicate); } @Override public

boolean anySatisfyWith(Predicate2 predicate, P parameter) { return this.delegate.anySatisfyWith(predicate, parameter); } @Override public boolean allSatisfy(Predicate predicate) { return this.delegate.allSatisfy(predicate); } @Override public

boolean allSatisfyWith(Predicate2 predicate, P parameter) { return this.delegate.allSatisfyWith(predicate, parameter); } @Override public boolean noneSatisfy(Predicate predicate) { return this.delegate.noneSatisfy(predicate); } @Override public

boolean noneSatisfyWith(Predicate2 predicate, P parameter) { return this.delegate.noneSatisfyWith(predicate, parameter); } @Override public IV injectInto(IV injectedValue, Function2 function) { return this.delegate.injectInto(injectedValue, function); } @Override public int injectInto(int injectedValue, IntObjectToIntFunction function) { return this.delegate.injectInto(injectedValue, function); } @Override public long injectInto(long injectedValue, LongObjectToLongFunction function) { return this.delegate.injectInto(injectedValue, function); } @Override public float injectInto(float injectedValue, FloatObjectToFloatFunction function) { return this.delegate.injectInto(injectedValue, function); } @Override public double injectInto(double injectedValue, DoubleObjectToDoubleFunction function) { return this.delegate.injectInto(injectedValue, function); } @Override public > R into(R target) { return this.delegate.into(target); } @Override public MutableList toList() { return this.delegate.toList(); } @Override public MutableList toSortedList() { return this.delegate.toSortedList(); } @Override public MutableList toSortedList(Comparator comparator) { return this.delegate.toSortedList(comparator); } @Override public MutableSet toSet() { return this.delegate.toSet(); } @Override public MutableSortedSet toSortedSet() { return this.delegate.toSortedSet(); } @Override public MutableSortedSet toSortedSet(Comparator comparator) { return this.delegate.toSortedSet(comparator); } @Override public MutableBag toBag() { return this.delegate.toBag(); } @Override public MutableSortedBag toSortedBag() { return this.delegate.toSortedBag(); } @Override public MutableSortedBag toSortedBag(Comparator comparator) { return this.delegate.toSortedBag(comparator); } @Override public MutableMap toMap(Function keyFunction, Function valueFunction) { return this.delegate.toMap(keyFunction, valueFunction); } @Override public > R toMap(Function keyFunction, Function valueFunction, R target) { return this.delegate.toMap(keyFunction, valueFunction, target); } @Override public MutableSortedMap toSortedMap(Function keyFunction, Function valueFunction) { return this.delegate.toSortedMap(keyFunction, valueFunction); } @Override public MutableSortedMap toSortedMap(Comparator comparator, Function keyFunction, Function valueFunction) { return this.delegate.toSortedMap(comparator, keyFunction, valueFunction); } @Override public MutableBiMap toBiMap(Function keyFunction, Function valueFunction) { return this.delegate.toBiMap(keyFunction, valueFunction); } @Override public LazyIterable asLazy() { return this.delegate.asLazy(); } @Override public Object[] toArray() { return this.delegate.toArray(); } @Override public T[] toArray(T[] a) { return this.delegate.toArray(a); } @Override public V min(Comparator comparator) { return this.delegate.min(comparator); } @Override public V max(Comparator comparator) { return this.delegate.max(comparator); } @Override public V min() { return this.delegate.min(); } @Override public V max() { return this.delegate.max(); } @Override public long sumOfInt(IntFunction function) { return this.delegate.sumOfInt(function); } @Override public double sumOfFloat(FloatFunction function) { return this.delegate.sumOfFloat(function); } @Override public long sumOfLong(LongFunction function) { return this.delegate.sumOfLong(function); } @Override public double sumOfDouble(DoubleFunction function) { return this.delegate.sumOfDouble(function); } @Override public String makeString() { return this.delegate.makeString(); } @Override public String makeString(String separator) { return this.delegate.makeString(separator); } @Override public String makeString(String start, String separator, String end) { return this.delegate.makeString(start, separator, end); } @Override public void appendString(Appendable appendable) { this.delegate.appendString(appendable); } @Override public void appendString(Appendable appendable, String separator) { this.delegate.appendString(appendable, separator); } @Override public void appendString(Appendable appendable, String start, String separator, String end) { this.delegate.appendString(appendable, start, separator, end); } @Override public ImmutableBagMultimap groupBy(Function function) { MutableBagMultimap bagMultimap = this.delegate.groupBy(function); return bagMultimap.toImmutable(); } @Override public > R groupBy(Function function, R target) { return this.delegate.groupBy(function, target); } @Override public ImmutableBagMultimap groupByEach(Function> function) { return this.delegate.groupByEach(function).toImmutable(); } @Override public > R groupByEach(Function> function, R target) { return this.delegate.groupByEach(function, target); } @Override public ImmutableMap groupByUniqueKey(Function function) { MutableMap map = this.delegate.groupByUniqueKey(function); return map.toImmutable(); } @Override public > R groupByUniqueKey(Function function, R target) { return this.delegate.groupByUniqueKey(function, target); } @Override public ImmutableBag> zip(Iterable that) { return this.delegate.zip(that).toImmutable(); } @Override public >> R zip(Iterable that, R target) { return this.delegate.zip(that, target); } @Override public ImmutableSet> zipWithIndex() { return this.delegate.zipWithIndex().toImmutable(); } @Override public >> R zipWithIndex(R target) { return this.delegate.zipWithIndex(target); } @Override public RichIterable> chunk(int size) { return this.delegate.chunk(size); } @Override public ImmutableMap aggregateBy(Function groupBy, Function0 zeroValueFactory, Function2 nonMutatingAggregator) { MutableMap map = this.delegate.aggregateBy(groupBy, zeroValueFactory, nonMutatingAggregator); return map.toImmutable(); } @Override public > V maxBy(Function function) { return this.delegate.maxBy(function); } @Override public > V minBy(Function function) { return this.delegate.minBy(function); } @Override public > MutableSortedSet toSortedSetBy(Function function) { return this.delegate.toSortedSetBy(function); } @Override public > MutableList toSortedListBy(Function function) { return this.delegate.toSortedListBy(function); } @Override public > R flatCollect(Function> function, R target) { return this.delegate.flatCollect(function, target); } @Override public > R collectIf(Predicate predicate, Function function, R target) { return this.delegate.collectIf(predicate, function, target); } @Override public > R collectWith(Function2 function, P parameter, R targetCollection) { return this.delegate.collectWith(function, parameter, targetCollection); } @Override public > R collect(Function function, R target) { return this.delegate.collect(function, target); } @Override public ImmutableCharObjectMap newWithKeyValue(char key, V value) { CharObjectHashMap map = new CharObjectHashMap<>(this); map.put(key, value); return map.toImmutable(); } @Override public ImmutableCharObjectMap newWithoutKey(char key) { CharObjectHashMap map = new CharObjectHashMap<>(this); map.removeKey(key); return map.toImmutable(); } @Override public ImmutableCharObjectMap newWithoutAllKeys(CharIterable keys) { CharObjectHashMap map = new CharObjectHashMap<>(this); CharIterator iterator = keys.charIterator(); while (iterator.hasNext()) { map.removeKey(iterator.next()); } return map.toImmutable(); } @Override public void forEach(Procedure procedure) { this.each(procedure); } @Override public void each(Procedure procedure) { this.delegate.forEach(procedure); } @Override public void forEachWithIndex(ObjectIntProcedure objectIntProcedure) { this.delegate.forEachWithIndex(objectIntProcedure); } @Override public

void forEachWith(Procedure2 procedure, P parameter) { this.delegate.forEachWith(procedure, parameter); } @Override public Iterator iterator() { return new UnmodifiableIteratorAdapter<>(this.delegate.iterator()); } @Override public MutableCharSet keySet() { return UnmodifiableCharSet.of(this.delegate.keySet()); } @Override public Collection values() { return UnmodifiableMutableCollection.of(this.delegate.values()); } @Override public LazyCharIterable keysView() { return this.delegate.keysView(); } @Override public RichIterable> keyValuesView() { return this.delegate.keyValuesView(); } @Override public ImmutableObjectCharMap flipUniqueValues() { MutableObjectCharMap result = ObjectCharMaps.mutable.empty(); this.forEachKeyValue((key, value) -> { if (result.containsKey(value)) { throw new IllegalStateException("Duplicate value: " + value + " found at key: " + result.get(value) + " and key: " + key); } result.put(value, key); }); return result.toImmutable(); } @Override public boolean equals(Object obj) { return this.delegate.equals(obj); } @Override public int hashCode() { return this.delegate.hashCode(); } @Override public String toString() { return this.delegate.toString(); } private Object writeReplace() { return new ImmutableCharObjectMapSerializationProxy(this); } }