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

org.eclipse.collections.impl.map.mutable.primitive.UnmodifiableFloatObjectMap 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.mutable.primitive;

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

import org.eclipse.collections.api.FloatIterable;
import org.eclipse.collections.api.LazyFloatIterable;
import org.eclipse.collections.api.LazyIterable;
import org.eclipse.collections.api.RichIterable;
import org.eclipse.collections.api.bag.MutableBag;
import org.eclipse.collections.api.bag.primitive.MutableBooleanBag;
import org.eclipse.collections.api.bag.primitive.MutableByteBag;
import org.eclipse.collections.api.bag.primitive.MutableCharBag;
import org.eclipse.collections.api.bag.primitive.MutableDoubleBag;
import org.eclipse.collections.api.bag.primitive.MutableFloatBag;
import org.eclipse.collections.api.bag.primitive.MutableIntBag;
import org.eclipse.collections.api.bag.primitive.MutableLongBag;
import org.eclipse.collections.api.bag.primitive.MutableShortBag;
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.FloatToObjectFunction;
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.FloatObjectPredicate;
import org.eclipse.collections.api.block.procedure.Procedure;
import org.eclipse.collections.api.block.procedure.Procedure2;
import org.eclipse.collections.api.block.procedure.primitive.FloatObjectProcedure;
import org.eclipse.collections.api.block.procedure.primitive.FloatProcedure;
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.list.MutableList;
import org.eclipse.collections.api.map.MutableMap;
import org.eclipse.collections.api.map.MutableMapIterable;
import org.eclipse.collections.api.map.primitive.FloatObjectMap;
import org.eclipse.collections.api.map.primitive.ImmutableFloatObjectMap;
import org.eclipse.collections.api.map.primitive.MutableObjectDoubleMap;
import org.eclipse.collections.api.map.primitive.MutableObjectLongMap;
import org.eclipse.collections.api.map.primitive.MutableFloatObjectMap;
import org.eclipse.collections.api.map.primitive.MutableObjectFloatMap;
import org.eclipse.collections.api.map.sorted.MutableSortedMap;
import org.eclipse.collections.api.multimap.MutableMultimap;
import org.eclipse.collections.api.multimap.bag.MutableBagMultimap;
import org.eclipse.collections.api.ordered.OrderedIterable;
import org.eclipse.collections.api.partition.bag.PartitionMutableBag;
import org.eclipse.collections.api.set.MutableSet;
import org.eclipse.collections.api.set.primitive.MutableFloatSet;
import org.eclipse.collections.api.set.sorted.MutableSortedSet;
import org.eclipse.collections.api.tuple.Pair;
import org.eclipse.collections.api.tuple.primitive.FloatObjectPair;
import org.eclipse.collections.impl.UnmodifiableIteratorAdapter;
import org.eclipse.collections.impl.factory.primitive.FloatObjectMaps;
import org.eclipse.collections.impl.set.mutable.primitive.UnmodifiableFloatSet;

/**
 * This file was automatically generated from template file unmodifiablePrimitiveObjectMap.stg.
 *
 * @since 3.2.
 */
public class UnmodifiableFloatObjectMap
        implements MutableFloatObjectMap, Serializable
{
    private static final long serialVersionUID = 1L;
    private final MutableFloatObjectMap map;

    public UnmodifiableFloatObjectMap(MutableFloatObjectMap map)
    {
        if (map == null)
        {
            throw new IllegalArgumentException("Cannot create a UnmodifiableFloatObjectMap on a null map");
        }

        this.map = map;
    }

    private boolean isAbsent(V result, float key)
    {
        return result == null && !this.containsKey(key);
    }

    private V getIfAbsentThrow(float key)
    {
        V result = this.map.get(key);
        if (this.isAbsent(result, key))
        {
            throw new UnsupportedOperationException("Cannot add to an " + this.getClass().getSimpleName());
        }
        return result;
    }

    @Override
    public V put(float key, V value)
    {
        throw new UnsupportedOperationException("Cannot call put() on " + this.getClass().getSimpleName());
    }

    @Override
    public V putPair(FloatObjectPair keyValuePair)
    {
        throw new UnsupportedOperationException("Cannot call putPair() on " + this.getClass().getSimpleName());
    }

    @Override
    public void putAll(FloatObjectMap map)
    {
        throw new UnsupportedOperationException("Cannot call putAll() on " + this.getClass().getSimpleName());
    }

    @Override
    public V removeKey(float key)
    {
        throw new UnsupportedOperationException("Cannot call removeKey() on " + this.getClass().getSimpleName());
    }

    @Override
    public V remove(float key)
    {
        throw new UnsupportedOperationException("Cannot call remove() on " + this.getClass().getSimpleName());
    }

    @Override
    public V getIfAbsentPut(float key, Function0 function)
    {
        return this.getIfAbsentThrow(key);
    }

    @Override
    public V getIfAbsentPut(float key, V value)
    {
        return this.getIfAbsentThrow(key);
    }

    @Override
    public V getIfAbsentPutWithKey(float key, FloatToObjectFunction function)
    {
        return this.getIfAbsentThrow(key);
    }

    @Override
    public 

V getIfAbsentPutWith(float key, Function function, P parameter) { return this.getIfAbsentThrow(key); } @Override public V updateValue(float key, Function0 factory, Function function) { throw new UnsupportedOperationException("Cannot call updateValue() on " + this.getClass().getSimpleName()); } @Override public

V updateValueWith(float key, Function0 factory, Function2 function, P parameter) { throw new UnsupportedOperationException("Cannot call updateValueWith() on " + this.getClass().getSimpleName()); } @Override public V get(float key) { return this.map.get(key); } @Override public V getIfAbsent(float key, Function0 ifAbsent) { return this.map.getIfAbsent(key, ifAbsent); } @Override public boolean containsKey(float key) { return this.map.containsKey(key); } @Override public boolean containsValue(Object value) { return this.map.containsValue(value); } @Override public MutableFloatObjectMap tap(Procedure procedure) { this.map.forEach(procedure); return this; } @Override public void forEachValue(Procedure procedure) { this.map.forEachValue(procedure); } @Override public void forEachKey(FloatProcedure procedure) { this.map.forEachKey(procedure); } @Override public void forEachKeyValue(FloatObjectProcedure procedure) { this.map.forEachKeyValue(procedure); } @Override public MutableFloatObjectMap select(FloatObjectPredicate predicate) { return this.map.select(predicate); } @Override public MutableFloatObjectMap reject(FloatObjectPredicate predicate) { return this.map.reject(predicate); } @Override public int size() { return this.map.size(); } @Override public boolean isEmpty() { return this.map.isEmpty(); } @Override public boolean notEmpty() { return this.map.notEmpty(); } @Override public V getFirst() { return this.map.getFirst(); } @Override public V getLast() { return this.map.getLast(); } @Override public V getOnly() { return this.map.getOnly(); } @Override public boolean contains(Object object) { return this.map.contains(object); } @Override public boolean containsAllIterable(Iterable source) { return this.map.containsAllIterable(source); } @Override public boolean containsAll(Collection source) { return this.map.containsAll(source); } @Override public boolean containsAllArguments(Object... elements) { return this.map.containsAllArguments(elements); } @Override public MutableBag select(Predicate predicate) { return this.map.select(predicate); } @Override public > R select(Predicate predicate, R target) { return this.map.select(predicate, target); } @Override public

MutableBag selectWith(Predicate2 predicate, P parameter) { return this.map.selectWith(predicate, parameter); } @Override public > R selectWith(Predicate2 predicate, P parameter, R targetCollection) { return this.map.selectWith(predicate, parameter, targetCollection); } @Override public PartitionMutableBag partition(Predicate predicate) { return this.map.partition(predicate); } @Override public

PartitionMutableBag partitionWith(Predicate2 predicate, P parameter) { return this.map.partitionWith(predicate, parameter); } @Override public MutableBag selectInstancesOf(Class clazz) { return this.map.selectInstancesOf(clazz); } /** * @deprecated in 7.0. Use {@link OrderedIterable#zipWithIndex} instead. */ @Deprecated @Override public MutableSet> zipWithIndex() { return this.map.zipWithIndex(); } @Override public >> R zipWithIndex(R target) { return this.map.zipWithIndex(target); } @Override public RichIterable> chunk(int size) { return this.map.chunk(size); } @Override public MutableMap aggregateInPlaceBy(Function groupBy, Function0 zeroValueFactory, Procedure2 mutatingAggregator) { return this.map.aggregateInPlaceBy(groupBy, zeroValueFactory, mutatingAggregator); } @Override public MutableMap aggregateBy(Function groupBy, Function0 zeroValueFactory, Function2 nonMutatingAggregator) { return this.map.aggregateBy(groupBy, zeroValueFactory, nonMutatingAggregator); } @Override public MutableBag reject(Predicate predicate) { return this.map.reject(predicate); } @Override public > R reject(Predicate predicate, R target) { return this.map.reject(predicate, target); } @Override public

MutableBag rejectWith(Predicate2 predicate, P parameter) { return this.map.rejectWith(predicate, parameter); } @Override public > R rejectWith(Predicate2 predicate, P parameter, R targetCollection) { return this.map.rejectWith(predicate, parameter, targetCollection); } @Override public void clear() { throw new UnsupportedOperationException("Cannot call clear() on " + this.getClass().getSimpleName()); } @Override public MutableBag collect(Function function) { return this.map.collect(function); } @Override public MutableBooleanBag collectBoolean(BooleanFunction booleanFunction) { return this.map.collectBoolean(booleanFunction); } @Override public R collectBoolean(BooleanFunction booleanFunction, R target) { return this.map.collectBoolean(booleanFunction, target); } @Override public MutableByteBag collectByte(ByteFunction byteFunction) { return this.map.collectByte(byteFunction); } @Override public R collectByte(ByteFunction byteFunction, R target) { return this.map.collectByte(byteFunction, target); } @Override public MutableCharBag collectChar(CharFunction charFunction) { return this.map.collectChar(charFunction); } @Override public R collectChar(CharFunction charFunction, R target) { return this.map.collectChar(charFunction, target); } @Override public MutableDoubleBag collectDouble(DoubleFunction doubleFunction) { return this.map.collectDouble(doubleFunction); } @Override public R collectDouble(DoubleFunction doubleFunction, R target) { return this.map.collectDouble(doubleFunction, target); } @Override public MutableFloatBag collectFloat(FloatFunction floatFunction) { return this.map.collectFloat(floatFunction); } @Override public R collectFloat(FloatFunction floatFunction, R target) { return this.map.collectFloat(floatFunction, target); } @Override public MutableIntBag collectInt(IntFunction intFunction) { return this.map.collectInt(intFunction); } @Override public R collectInt(IntFunction intFunction, R target) { return this.map.collectInt(intFunction, target); } @Override public MutableLongBag collectLong(LongFunction longFunction) { return this.map.collectLong(longFunction); } @Override public R collectLong(LongFunction longFunction, R target) { return this.map.collectLong(longFunction, target); } @Override public MutableShortBag collectShort(ShortFunction shortFunction) { return this.map.collectShort(shortFunction); } @Override public R collectShort(ShortFunction shortFunction, R target) { return this.map.collectShort(shortFunction, target); } @Override public MutableBag collectWith(Function2 function, P parameter) { return this.map.collectWith(function, parameter); } @Override public > R collectWith(Function2 function, P parameter, R targetCollection) { return this.map.collectWith(function, parameter, targetCollection); } @Override public > R collect(Function function, R target) { return this.map.collect(function, target); } @Override public MutableBag collectIf(Predicate predicate, Function function) { return this.map.collectIf(predicate, function); } @Override public > R collectIf(Predicate predicate, Function function, R target) { return this.map.collectIf(predicate, function, target); } @Override public MutableBag flatCollect(Function> function) { return this.map.flatCollect(function); } @Override public > R flatCollect(Function> function, R target) { return this.map.flatCollect(function, target); } @Override public V detect(Predicate predicate) { return this.map.detect(predicate); } @Override public

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

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

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

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

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

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

boolean noneSatisfyWith(Predicate2 predicate, P parameter) { return this.map.noneSatisfyWith(predicate, parameter); } @Override public IV injectInto(IV injectedValue, Function2 function) { return this.map.injectInto(injectedValue, function); } @Override public int injectInto(int injectedValue, IntObjectToIntFunction function) { return this.map.injectInto(injectedValue, function); } @Override public long injectInto(long injectedValue, LongObjectToLongFunction function) { return this.map.injectInto(injectedValue, function); } @Override public float injectInto(float injectedValue, FloatObjectToFloatFunction function) { return this.map.injectInto(injectedValue, function); } @Override public double injectInto(double injectedValue, DoubleObjectToDoubleFunction function) { return this.map.injectInto(injectedValue, function); } @Override public > R into(R target) { return this.map.into(target); } @Override public MutableList toList() { return this.map.toList(); } @Override public MutableList toSortedList() { return this.map.toSortedList(); } @Override public MutableList toSortedList(Comparator comparator) { return this.map.toSortedList(comparator); } @Override public > MutableList toSortedListBy(Function function) { return this.map.toSortedListBy(function); } @Override public MutableSet toSet() { return this.map.toSet(); } @Override public MutableSortedSet toSortedSet() { return this.map.toSortedSet(); } @Override public MutableSortedSet toSortedSet(Comparator comparator) { return this.map.toSortedSet(comparator); } @Override public > MutableSortedSet toSortedSetBy(Function function) { return this.map.toSortedSetBy(function); } @Override public MutableBag toBag() { return this.map.toBag(); } @Override public MutableSortedBag toSortedBag() { return this.map.toSortedBag(); } @Override public MutableSortedBag toSortedBag(Comparator comparator) { return this.map.toSortedBag(comparator); } @Override public > MutableSortedBag toSortedBagBy(Function function) { return this.map.toSortedBagBy(function); } @Override public MutableMap toMap(Function keyFunction, Function valueFunction) { return this.map.toMap(keyFunction, valueFunction); } @Override public MutableSortedMap toSortedMap(Function keyFunction, Function valueFunction) { return this.map.toSortedMap(keyFunction, valueFunction); } @Override public MutableSortedMap toSortedMap(Comparator comparator, Function keyFunction, Function valueFunction) { return this.map.toSortedMap(comparator, keyFunction, valueFunction); } @Override public , NK, NV> MutableSortedMap toSortedMapBy(Function sortBy, Function keyFunction, Function valueFunction) { return this.map.toSortedMapBy(sortBy, keyFunction, valueFunction); } @Override public MutableBiMap toBiMap(Function keyFunction, Function valueFunction) { return this.map.toBiMap(keyFunction, valueFunction); } @Override public LazyIterable asLazy() { return this.map.asLazy(); } @Override public Object[] toArray() { return this.map.toArray(); } @Override public T[] toArray(T[] a) { return this.map.toArray(a); } @Override public V min(Comparator comparator) { return this.map.min(comparator); } @Override public V max(Comparator comparator) { return this.map.max(comparator); } @Override public V min() { return this.map.min(); } @Override public V max() { return this.map.max(); } @Override public > V maxBy(Function function) { return this.map.maxBy(function); } @Override public > V minBy(Function function) { return this.map.minBy(function); } @Override public long sumOfInt(IntFunction function) { return this.map.sumOfInt(function); } @Override public double sumOfFloat(FloatFunction function) { return this.map.sumOfFloat(function); } @Override public long sumOfLong(LongFunction function) { return this.map.sumOfLong(function); } @Override public double sumOfDouble(DoubleFunction function) { return this.map.sumOfDouble(function); } @Override public MutableObjectLongMap sumByInt(Function groupBy, IntFunction function) { return this.map.sumByInt(groupBy, function); } @Override public MutableObjectDoubleMap sumByFloat(Function groupBy, FloatFunction function) { return this.map.sumByFloat(groupBy, function); } @Override public MutableObjectLongMap sumByLong(Function groupBy, LongFunction function) { return this.map.sumByLong(groupBy, function); } @Override public MutableObjectDoubleMap sumByDouble(Function groupBy, DoubleFunction function) { return this.map.sumByDouble(groupBy, function); } @Override public MutableFloatSet keySet() { return UnmodifiableFloatSet.of(this.map.keySet()); } @Override public Collection values() { return Collections.unmodifiableCollection(this.map.values()); } @Override public LazyFloatIterable keysView() { return this.map.keysView(); } @Override public RichIterable> keyValuesView() { return this.map.keyValuesView(); } @Override public MutableObjectFloatMap flipUniqueValues() { return this.map.flipUniqueValues().asUnmodifiable(); } @Override public boolean equals(Object obj) { return this.map.equals(obj); } @Override public int hashCode() { return this.map.hashCode(); } @Override public String toString() { return this.map.toString(); } @Override public String makeString() { return this.map.makeString(); } @Override public String makeString(String separator) { return this.map.makeString(separator); } @Override public String makeString(String start, String separator, String end) { return this.map.makeString(start, separator, end); } @Override public void appendString(Appendable appendable) { this.map.appendString(appendable); } @Override public void appendString(Appendable appendable, String separator) { this.map.appendString(appendable, separator); } @Override public void appendString(Appendable appendable, String start, String separator, String end) { this.map.appendString(appendable, start, separator, end); } @Override public MutableBagMultimap groupBy(Function function) { return this.map.groupBy(function); } @Override public > R groupBy(Function function, R target) { return this.map.groupBy(function, target); } @Override public MutableBagMultimap groupByEach(Function> function) { return this.map.groupByEach(function); } @Override public > R groupByEach(Function> function, R target) { return this.map.groupByEach(function, target); } @Override public MutableMap groupByUniqueKey(Function function) { return this.map.groupByUniqueKey(function); } @Override public > R groupByUniqueKey(Function function, R target) { return this.map.groupByUniqueKey(function, target); } /** * @deprecated in 7.0. Use {@link OrderedIterable#zip(Iterable)} instead. */ @Deprecated @Override public MutableBag> zip(Iterable that) { return this.map.zip(that); } @Override public >> R zip(Iterable that, R target) { return this.map.zip(that, target); } @Override public MutableFloatObjectMap withKeyValue(float key, V value) { throw new UnsupportedOperationException("Cannot call withKeyValue() on " + this.getClass().getSimpleName()); } @Override public MutableFloatObjectMap withoutKey(float key) { throw new UnsupportedOperationException("Cannot call withoutKey() on " + this.getClass().getSimpleName()); } @Override public MutableFloatObjectMap withoutAllKeys(FloatIterable keys) { throw new UnsupportedOperationException("Cannot call withoutAllKeys() on " + this.getClass().getSimpleName()); } @Override public MutableFloatObjectMap asUnmodifiable() { return this; } @Override public MutableFloatObjectMap asSynchronized() { return new SynchronizedFloatObjectMap<>(this); } @Override public ImmutableFloatObjectMap toImmutable() { return FloatObjectMaps.immutable.withAll(this); } @Override public void forEach(Procedure procedure) { this.each(procedure); } @Override public void each(Procedure procedure) { this.map.forEach(procedure); } @Override public void forEachWithIndex(ObjectIntProcedure objectIntProcedure) { this.map.forEachWithIndex(objectIntProcedure); } @Override public

void forEachWith(Procedure2 procedure, P parameter) { this.map.forEachWith(procedure, parameter); } @Override public Iterator iterator() { return new UnmodifiableIteratorAdapter<>(this.map.iterator()); } }