org.eclipse.collections.impl.map.immutable.primitive.ImmutableFloatObjectEmptyMap Maven / Gradle / Ivy
Show all versions of eclipse-collections Show documentation
/*
* 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.IOException;
import java.io.Serializable;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Optional;
import org.eclipse.collections.api.BooleanIterable;
import org.eclipse.collections.api.ByteIterable;
import org.eclipse.collections.api.CharIterable;
import org.eclipse.collections.api.DoubleIterable;
import org.eclipse.collections.api.FloatIterable;
import org.eclipse.collections.api.IntIterable;
import org.eclipse.collections.api.LongIterable;
import org.eclipse.collections.api.ShortIterable;
import org.eclipse.collections.api.LazyFloatIterable;
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.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.factory.Lists;
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.FloatObjectMap;
import org.eclipse.collections.api.map.primitive.ImmutableFloatObjectMap;
import org.eclipse.collections.api.map.primitive.ImmutableObjectFloatMap;
import org.eclipse.collections.api.map.primitive.ImmutableObjectDoubleMap;
import org.eclipse.collections.api.map.primitive.ImmutableObjectLongMap;
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.partition.bag.PartitionImmutableBag;
import org.eclipse.collections.api.set.ImmutableSet;
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.bag.sorted.mutable.TreeBag;
import org.eclipse.collections.impl.factory.Bags;
import org.eclipse.collections.impl.factory.BiMaps;
import org.eclipse.collections.impl.factory.Maps;
import org.eclipse.collections.impl.factory.Multimaps;
import org.eclipse.collections.impl.factory.Sets;
import org.eclipse.collections.impl.factory.SortedMaps;
import org.eclipse.collections.impl.factory.SortedSets;
import org.eclipse.collections.impl.factory.primitive.BooleanBags;
import org.eclipse.collections.impl.factory.primitive.ByteBags;
import org.eclipse.collections.impl.factory.primitive.CharBags;
import org.eclipse.collections.impl.factory.primitive.DoubleBags;
import org.eclipse.collections.impl.factory.primitive.FloatBags;
import org.eclipse.collections.impl.factory.primitive.IntBags;
import org.eclipse.collections.impl.factory.primitive.LongBags;
import org.eclipse.collections.impl.factory.primitive.ShortBags;
import org.eclipse.collections.impl.factory.primitive.ObjectDoubleMaps;
import org.eclipse.collections.impl.factory.primitive.ObjectLongMaps;
import org.eclipse.collections.impl.factory.primitive.ObjectFloatMaps;
import org.eclipse.collections.impl.lazy.LazyIterableAdapter;
import org.eclipse.collections.impl.map.mutable.primitive.FloatObjectHashMap;
import org.eclipse.collections.impl.partition.bag.PartitionHashBag;
import org.eclipse.collections.impl.set.mutable.primitive.FloatHashSet;
import org.eclipse.collections.impl.set.mutable.primitive.UnmodifiableFloatSet;
import org.eclipse.collections.impl.utility.LazyIterate;
import org.eclipse.collections.impl.utility.primitive.LazyFloatIterate;
/**
* ImmutableFloatObjectEmptyMap is an optimization for {@link ImmutableFloatObjectMap} of size 0.
* This file was automatically generated from template file immutablePrimitiveObjectEmptyMap.stg.
*
* @since 4.0.
*/
final class ImmutableFloatObjectEmptyMap implements ImmutableFloatObjectMap, Serializable
{
static final ImmutableFloatObjectMap> INSTANCE = new ImmutableFloatObjectEmptyMap<>();
private static final long serialVersionUID = 1L;
private Object readResolve()
{
return INSTANCE;
}
@Override
public V get(float key)
{
return null;
}
@Override
public V getIfAbsent(float key, Function0 extends V> ifAbsent)
{
return ifAbsent.value();
}
@Override
public boolean containsKey(float key)
{
return false;
}
@Override
public boolean containsValue(Object value)
{
return false;
}
@Override
public ImmutableFloatObjectMap tap(Procedure super V> procedure)
{
return this;
}
@Override
public void forEachValue(Procedure super V> procedure)
{
}
@Override
public void forEachKey(FloatProcedure procedure)
{
}
@Override
public void forEachKeyValue(FloatObjectProcedure super V> procedure)
{
}
@Override
public ImmutableFloatObjectMap select(FloatObjectPredicate super V> predicate)
{
return this;
}
@Override
public ImmutableFloatObjectMap reject(FloatObjectPredicate super V> predicate)
{
return this;
}
@Override
public ImmutableFloatObjectMap toImmutable()
{
return this;
}
@Override
public int size()
{
return 0;
}
@Override
public boolean isEmpty()
{
return true;
}
@Override
public boolean notEmpty()
{
return false;
}
@Override
public V getFirst()
{
return null;
}
@Override
public V getLast()
{
return null;
}
@Override
public V getOnly()
{
throw new IllegalStateException("Size must be 1 but was " + this.size());
}
@Override
public boolean contains(Object object)
{
return false;
}
@Override
public boolean containsAllIterable(Iterable> source)
{
return !source.iterator().hasNext();
}
@Override
public boolean containsAll(Collection> source)
{
return source.isEmpty();
}
@Override
public boolean containsAllArguments(Object... elements)
{
return elements.length == 0;
}
@Override
public ImmutableBag select(Predicate super V> predicate)
{
return Bags.immutable.empty();
}
@Override
public ImmutableBag selectWith(Predicate2 super V, ? super P> predicate, P parameter)
{
return Bags.immutable.empty();
}
@Override
public ImmutableBag reject(Predicate super V> predicate)
{
return Bags.immutable.empty();
}
@Override
public ImmutableBag rejectWith(Predicate2 super V, ? super P> predicate, P parameter)
{
return Bags.immutable.empty();
}
@Override
public > R select(Predicate super V> predicate, R target)
{
return target;
}
@Override
public > R selectWith(Predicate2 super V, ? super P> predicate, P parameter, R target)
{
return target;
}
@Override
public > R reject(Predicate super V> predicate, R target)
{
return target;
}
@Override
public > R rejectWith(Predicate2 super V, ? super P> predicate, P parameter, R target)
{
return target;
}
@Override
public PartitionImmutableBag partition(Predicate super V> predicate)
{
return new PartitionHashBag().toImmutable();
}
@Override
public PartitionImmutableBag partitionWith(Predicate2 super V, ? super P> predicate, P parameter)
{
return new PartitionHashBag().toImmutable();
}
@Override
public ImmutableBag selectInstancesOf(Class clazz)
{
return Bags.immutable.empty();
}
@Override
public ImmutableBag collect(Function super V, ? extends VV> function)
{
return Bags.immutable.empty();
}
@Override
public ImmutableBag collectWith(Function2 super V, ? super P, ? extends VV> function, P parameter)
{
return Bags.immutable.empty();
}
@Override
public ImmutableBag collectIf(Predicate super V> predicate, Function super V, ? extends VV> function)
{
return Bags.immutable.empty();
}
@Override
public ImmutableBooleanBag collectBoolean(BooleanFunction super V> booleanFunction)
{
return BooleanBags.immutable.empty();
}
@Override
public R collectBoolean(BooleanFunction super V> booleanFunction, R target)
{
return target;
}
@Override
public ImmutableByteBag collectByte(ByteFunction super V> byteFunction)
{
return ByteBags.immutable.empty();
}
@Override
public R collectByte(ByteFunction super V> byteFunction, R target)
{
return target;
}
@Override
public ImmutableCharBag collectChar(CharFunction super V> charFunction)
{
return CharBags.immutable.empty();
}
@Override
public R collectChar(CharFunction super V> charFunction, R target)
{
return target;
}
@Override
public ImmutableDoubleBag collectDouble(DoubleFunction super V> doubleFunction)
{
return DoubleBags.immutable.empty();
}
@Override
public R collectDouble(DoubleFunction super V> doubleFunction, R target)
{
return target;
}
@Override
public ImmutableFloatBag collectFloat(FloatFunction super V> floatFunction)
{
return FloatBags.immutable.empty();
}
@Override
public R collectFloat(FloatFunction super V> floatFunction, R target)
{
return target;
}
@Override
public ImmutableIntBag collectInt(IntFunction super V> intFunction)
{
return IntBags.immutable.empty();
}
@Override
public R collectInt(IntFunction super V> intFunction, R target)
{
return target;
}
@Override
public ImmutableLongBag collectLong(LongFunction super V> longFunction)
{
return LongBags.immutable.empty();
}
@Override
public R collectLong(LongFunction super V> longFunction, R target)
{
return target;
}
@Override
public ImmutableShortBag collectShort(ShortFunction super V> shortFunction)
{
return ShortBags.immutable.empty();
}
@Override
public R collectShort(ShortFunction super V> shortFunction, R target)
{
return target;
}
@Override
public ImmutableBag flatCollect(Function super V, ? extends Iterable> function)
{
return Bags.immutable.empty();
}
@Override
public R flatCollectByte(
Function super V, ? extends ByteIterable> function,
R target)
{
return target;
}
@Override
public R flatCollectChar(
Function super V, ? extends CharIterable> function,
R target)
{
return target;
}
@Override
public R flatCollectInt(
Function super V, ? extends IntIterable> function,
R target)
{
return target;
}
@Override
public R flatCollectShort(
Function super V, ? extends ShortIterable> function,
R target)
{
return target;
}
@Override
public R flatCollectDouble(
Function super V, ? extends DoubleIterable> function,
R target)
{
return target;
}
@Override
public R flatCollectFloat(
Function super V, ? extends FloatIterable> function,
R target)
{
return target;
}
@Override
public R flatCollectLong(
Function super V, ? extends LongIterable> function,
R target)
{
return target;
}
@Override
public R flatCollectBoolean(
Function super V, ? extends BooleanIterable> function,
R target)
{
return target;
}
@Override
public V detect(Predicate super V> predicate)
{
return null;
}
@Override
public V detectWith(Predicate2 super V, ? super P> predicate, P parameter)
{
return null;
}
@Override
public Optional detectOptional(Predicate super V> predicate)
{
return Optional.empty();
}
@Override
public Optional detectWithOptional(Predicate2 super V, ? super P> predicate, P parameter)
{
return Optional.empty();
}
@Override
public V detectIfNone(Predicate super V> predicate, Function0 extends V> function)
{
return function.value();
}
@Override
public V detectWithIfNone(Predicate2 super V, ? super P> predicate, P parameter, Function0 extends V> function)
{
return function.value();
}
@Override
public int count(Predicate super V> predicate)
{
return 0;
}
@Override
public
int countWith(Predicate2 super V, ? super P> predicate, P parameter)
{
return 0;
}
@Override
public boolean anySatisfy(Predicate super V> predicate)
{
return false;
}
@Override
public
boolean anySatisfyWith(Predicate2 super V, ? super P> predicate, P parameter)
{
return false;
}
@Override
public boolean allSatisfy(Predicate super V> predicate)
{
return true;
}
@Override
public
boolean allSatisfyWith(Predicate2 super V, ? super P> predicate, P parameter)
{
return true;
}
@Override
public boolean noneSatisfy(Predicate super V> predicate)
{
return true;
}
@Override
public
boolean noneSatisfyWith(Predicate2 super V, ? super P> predicate, P parameter)
{
return true;
}
@Override
public IV injectInto(IV injectedValue, Function2 super IV, ? super V, ? extends IV> function)
{
return injectedValue;
}
@Override
public int injectInto(int injectedValue, IntObjectToIntFunction super V> function)
{
return injectedValue;
}
@Override
public long injectInto(long injectedValue, LongObjectToLongFunction super V> function)
{
return injectedValue;
}
@Override
public float injectInto(float injectedValue, FloatObjectToFloatFunction super V> function)
{
return injectedValue;
}
@Override
public double injectInto(double injectedValue, DoubleObjectToDoubleFunction super V> function)
{
return injectedValue;
}
@Override
public > R into(R target)
{
return target;
}
@Override
public MutableList toList()
{
return Lists.mutable.with();
}
@Override
public MutableList toSortedList()
{
return Lists.mutable.with();
}
@Override
public MutableList toSortedList(Comparator super V> comparator)
{
return Lists.mutable.with();
}
@Override
public MutableSet toSet()
{
return Sets.mutable.with();
}
@Override
public MutableSortedSet toSortedSet()
{
return SortedSets.mutable.with();
}
@Override
public MutableSortedSet toSortedSet(Comparator super V> comparator)
{
return SortedSets.mutable.with();
}
@Override
public MutableBag toBag()
{
return Bags.mutable.with();
}
@Override
public MutableSortedBag toSortedBag()
{
return TreeBag.newBag();
}
@Override
public MutableSortedBag toSortedBag(Comparator super V> comparator)
{
return TreeBag.newBag(comparator);
}
@Override
public MutableMap toMap(Function super V, ? extends NK> keyFunction, Function super V, ? extends NV> valueFunction)
{
return Maps.mutable.with();
}
@Override
public > R toMap(Function super V, ? extends NK> keyFunction, Function super V, ? extends NV> valueFunction, R target)
{
return target;
}
@Override
public MutableSortedMap toSortedMap(Function super V, ? extends NK> keyFunction, Function super V, ? extends NV> valueFunction)
{
return SortedMaps.mutable.with();
}
@Override
public MutableSortedMap toSortedMap(Comparator super NK> comparator, Function super V, ? extends NK> keyFunction, Function super V, ? extends NV> valueFunction)
{
return SortedMaps.mutable.with();
}
@Override
public , NK, NV> MutableSortedMap toSortedMapBy(Function super NK, KK> sortBy, Function super V, ? extends NK> keyFunction, Function super V, ? extends NV> valueFunction)
{
return SortedMaps.mutable.with();
}
@Override
public MutableBiMap toBiMap(Function super V, ? extends NK> keyFunction, Function super V, ? extends NV> valueFunction)
{
return BiMaps.mutable.empty();
}
@Override
public LazyIterable asLazy()
{
return new LazyIterableAdapter<>(Lists.immutable.empty());
}
@Override
public Object[] toArray()
{
return new Object[0];
}
@Override
public T[] toArray(T[] a)
{
return (T[]) new Object[0];
}
@Override
public V min(Comparator super V> comparator)
{
throw new NoSuchElementException();
}
@Override
public V max(Comparator super V> comparator)
{
throw new NoSuchElementException();
}
@Override
public V min()
{
throw new NoSuchElementException();
}
@Override
public V max()
{
throw new NoSuchElementException();
}
@Override
public long sumOfInt(IntFunction super V> function)
{
return 0L;
}
@Override
public double sumOfFloat(FloatFunction super V> function)
{
return 0.0;
}
@Override
public long sumOfLong(LongFunction super V> function)
{
return 0L;
}
@Override
public double sumOfDouble(DoubleFunction super V> function)
{
return 0.0;
}
@Override
public ImmutableObjectLongMap sumByInt(Function super V, ? extends V1> groupBy, IntFunction super V> function)
{
return ObjectLongMaps.immutable.empty();
}
@Override
public ImmutableObjectDoubleMap sumByFloat(Function super V, ? extends V1> groupBy, FloatFunction super V> function)
{
return ObjectDoubleMaps.immutable.empty();
}
@Override
public ImmutableObjectLongMap sumByLong(Function super V, ? extends V1> groupBy, LongFunction super V> function)
{
return ObjectLongMaps.immutable.empty();
}
@Override
public ImmutableObjectDoubleMap sumByDouble(Function super V, ? extends V1> groupBy, DoubleFunction super V> function)
{
return ObjectDoubleMaps.immutable.empty();
}
@Override
public MutableFloatSet keySet()
{
return UnmodifiableFloatSet.of(FloatHashSet.newSetWith());
}
@Override
public Collection values()
{
return Lists.immutable.of().castToList();
}
@Override
public LazyFloatIterable keysView()
{
return LazyFloatIterate.empty();
}
@Override
public RichIterable> keyValuesView()
{
return LazyIterate.empty();
}
@Override
public ImmutableObjectFloatMap flipUniqueValues()
{
return ObjectFloatMaps.immutable.empty();
}
@Override
public boolean equals(Object obj)
{
if (obj == this)
{
return true;
}
if (!(obj instanceof FloatObjectMap))
{
return false;
}
FloatObjectMap map = (FloatObjectMap) obj;
return map.isEmpty();
}
@Override
public int hashCode()
{
return 0;
}
@Override
public String toString()
{
return "{}";
}
@Override
public String makeString()
{
return "";
}
@Override
public String makeString(String separator)
{
return "";
}
@Override
public String makeString(String start, String separator, String end)
{
return start + end;
}
@Override
public void appendString(Appendable appendable)
{
}
@Override
public void appendString(Appendable appendable, String separator)
{
}
@Override
public void appendString(Appendable appendable, String start, String separator, String end)
{
try
{
appendable.append(start);
appendable.append(end);
}
catch (IOException e)
{
throw new RuntimeException(e);
}
}
@Override
public ImmutableBagMultimap groupBy(Function super V, ? extends VV> function)
{
return Multimaps.immutable.bag.empty();
}
@Override
public > R groupBy(Function super V, ? extends VV> function, R target)
{
return target;
}
@Override
public ImmutableBagMultimap groupByEach(Function super V, ? extends Iterable> function)
{
return Multimaps.immutable.bag.empty();
}
@Override
public > R groupByEach(Function super V, ? extends Iterable> function, R target)
{
return target;
}
@Override
public ImmutableMap groupByUniqueKey(Function super V, ? extends VV> function)
{
return Maps.immutable.empty();
}
@Override
public > R groupByUniqueKey(Function super V, ? extends VV> function, R target)
{
return target;
}
@Override
public ImmutableBag> zip(Iterable that)
{
return Bags.immutable.empty();
}
@Override
public >> R zip(Iterable that, R target)
{
return target;
}
@Override
public ImmutableSet> zipWithIndex()
{
return Sets.immutable.empty();
}
@Override
public >> R zipWithIndex(R target)
{
return target;
}
@Override
public RichIterable> chunk(int size)
{
return Lists.immutable.of();
}
@Override
public > V maxBy(Function super V, ? extends VV> function)
{
throw new NoSuchElementException();
}
@Override
public > V minBy(Function super V, ? extends VV> function)
{
throw new NoSuchElementException();
}
@Override
public > MutableSortedSet toSortedSetBy(Function super V, ? extends VV> function)
{
return SortedSets.mutable.of();
}
@Override
public > MutableList toSortedListBy(Function super V, ? extends VV> function)
{
return Lists.mutable.of();
}
@Override
public > R flatCollect(Function super V, ? extends Iterable> function, R target)
{
return target;
}
@Override
public > R collectIf(Predicate super V> predicate, Function super V, ? extends VV> function, R target)
{
return target;
}
@Override
public > R collectWith(Function2 super V, ? super P, ? extends VV> function, P parameter, R targetCollection)
{
return targetCollection;
}
@Override
public > R collect(Function super V, ? extends VV> function, R target)
{
return target;
}
@Override
public ImmutableFloatObjectMap newWithKeyValue(float key, V value)
{
FloatObjectHashMap map = new FloatObjectHashMap<>();
map.put(key, value);
return map.toImmutable();
}
@Override
public ImmutableFloatObjectMap newWithoutKey(float key)
{
return this;
}
@Override
public ImmutableFloatObjectMap newWithoutAllKeys(FloatIterable keys)
{
return this;
}
@Override
public void forEach(Procedure super V> procedure)
{
}
@Override
public void each(Procedure super V> procedure)
{
}
@Override
public void forEachWithIndex(ObjectIntProcedure super V> objectIntProcedure)
{
}
@Override
public void forEachWith(Procedure2 super V, ? super P> procedure, P parameter)
{
}
@Override
public Iterator iterator()
{
return new InternalIterator();
}
private class InternalIterator implements Iterator
{
@Override
public boolean hasNext()
{
return false;
}
@Override
public V next()
{
throw new NoSuchElementException();
}
@Override
public void remove()
{
throw new UnsupportedOperationException("Cannot call remove() on " + this.getClass().getSimpleName());
}
}
}