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

com.gs.collections.impl.map.immutable.primitive.ImmutableDoubleObjectEmptyMap Maven / Gradle / Ivy

/*
 * Copyright 2014 Goldman Sachs.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.gs.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.NoSuchElementException;

import com.gs.collections.api.DoubleIterable;
import com.gs.collections.api.LazyIterable;
import com.gs.collections.api.LazyDoubleIterable;
import com.gs.collections.api.RichIterable;
import com.gs.collections.api.bag.MutableBag;
import com.gs.collections.api.block.function.Function;
import com.gs.collections.api.block.function.Function0;
import com.gs.collections.api.block.function.Function2;
import com.gs.collections.api.block.function.primitive.BooleanFunction;
import com.gs.collections.api.block.function.primitive.ByteFunction;
import com.gs.collections.api.block.function.primitive.CharFunction;
import com.gs.collections.api.block.function.primitive.DoubleFunction;
import com.gs.collections.api.block.function.primitive.DoubleObjectToDoubleFunction;
import com.gs.collections.api.block.function.primitive.FloatFunction;
import com.gs.collections.api.block.function.primitive.FloatObjectToFloatFunction;
import com.gs.collections.api.block.function.primitive.IntFunction;
import com.gs.collections.api.block.function.primitive.IntObjectToIntFunction;
import com.gs.collections.api.block.function.primitive.LongFunction;
import com.gs.collections.api.block.function.primitive.LongObjectToLongFunction;
import com.gs.collections.api.block.function.primitive.ShortFunction;
import com.gs.collections.api.block.predicate.Predicate;
import com.gs.collections.api.block.predicate.Predicate2;
import com.gs.collections.api.block.predicate.primitive.DoubleObjectPredicate;
import com.gs.collections.api.block.procedure.Procedure;
import com.gs.collections.api.block.procedure.Procedure2;
import com.gs.collections.api.block.procedure.primitive.DoubleObjectProcedure;
import com.gs.collections.api.block.procedure.primitive.DoubleProcedure;
import com.gs.collections.api.block.procedure.primitive.ObjectIntProcedure;
import com.gs.collections.api.collection.ImmutableCollection;
import com.gs.collections.api.collection.primitive.ImmutableBooleanCollection;
import com.gs.collections.api.collection.primitive.ImmutableByteCollection;
import com.gs.collections.api.collection.primitive.ImmutableCharCollection;
import com.gs.collections.api.collection.primitive.ImmutableDoubleCollection;
import com.gs.collections.api.collection.primitive.ImmutableFloatCollection;
import com.gs.collections.api.collection.primitive.ImmutableIntCollection;
import com.gs.collections.api.collection.primitive.ImmutableLongCollection;
import com.gs.collections.api.collection.primitive.ImmutableShortCollection;
import com.gs.collections.api.list.MutableList;
import com.gs.collections.api.map.MapIterable;
import com.gs.collections.api.map.MutableMap;
import com.gs.collections.api.map.primitive.DoubleObjectMap;
import com.gs.collections.api.map.primitive.ImmutableDoubleObjectMap;
import com.gs.collections.api.map.sorted.MutableSortedMap;
import com.gs.collections.api.multimap.Multimap;
import com.gs.collections.api.multimap.MutableMultimap;
import com.gs.collections.api.partition.PartitionIterable;
import com.gs.collections.api.set.MutableSet;
import com.gs.collections.api.set.primitive.MutableDoubleSet;
import com.gs.collections.api.set.sorted.MutableSortedSet;
import com.gs.collections.api.tuple.Pair;
import com.gs.collections.api.tuple.primitive.DoubleObjectPair;
import com.gs.collections.impl.factory.Bags;
import com.gs.collections.impl.factory.Lists;
import com.gs.collections.impl.factory.Maps;
import com.gs.collections.impl.factory.Sets;
import com.gs.collections.impl.factory.SortedMaps;
import com.gs.collections.impl.factory.SortedSets;
import com.gs.collections.impl.factory.primitive.BooleanLists;
import com.gs.collections.impl.factory.primitive.ByteLists;
import com.gs.collections.impl.factory.primitive.CharLists;
import com.gs.collections.impl.factory.primitive.DoubleLists;
import com.gs.collections.impl.factory.primitive.FloatLists;
import com.gs.collections.impl.factory.primitive.IntLists;
import com.gs.collections.impl.factory.primitive.LongLists;
import com.gs.collections.impl.factory.primitive.ShortLists;
import com.gs.collections.impl.lazy.LazyIterableAdapter;
import com.gs.collections.impl.list.mutable.FastList;
import com.gs.collections.impl.map.mutable.primitive.DoubleObjectHashMap;
import com.gs.collections.impl.multimap.list.FastListMultimap;
import com.gs.collections.impl.partition.list.PartitionFastList;
import com.gs.collections.impl.set.mutable.primitive.DoubleHashSet;
import com.gs.collections.impl.set.mutable.primitive.UnmodifiableDoubleSet;
import com.gs.collections.impl.utility.LazyIterate;
import com.gs.collections.impl.utility.primitive.LazyDoubleIterate;
import com.gs.collections.api.collection.primitive.MutableBooleanCollection;
import com.gs.collections.api.collection.primitive.MutableByteCollection;
import com.gs.collections.api.collection.primitive.MutableCharCollection;
import com.gs.collections.api.collection.primitive.MutableDoubleCollection;
import com.gs.collections.api.collection.primitive.MutableFloatCollection;
import com.gs.collections.api.collection.primitive.MutableIntCollection;
import com.gs.collections.api.collection.primitive.MutableLongCollection;
import com.gs.collections.api.collection.primitive.MutableShortCollection;

/**
 * ImmutableDoubleObjectEmptyMap is an optimization for {@link ImmutableDoubleObjectMap} of size 0.
 * This file was automatically generated from template file immutablePrimitiveObjectEmptyMap.stg.
 *
 * @since 4.0.
 */
final class ImmutableDoubleObjectEmptyMap implements ImmutableDoubleObjectMap, Serializable
{
    private static final long serialVersionUID = 1L;
    static final ImmutableDoubleObjectMap INSTANCE = new ImmutableDoubleObjectEmptyMap();

    private Object readResolve()
    {
        return INSTANCE;
    }

    public V get(double key)
    {
        return null;
    }

    public V getIfAbsent(double key, Function0 ifAbsent)
    {
        return ifAbsent.value();
    }

    public boolean containsKey(double key)
    {
        return false;
    }

    public boolean containsValue(Object value)
    {
        return false;
    }

    public void forEachValue(Procedure procedure)
    {
    }

    public void forEachKey(DoubleProcedure procedure)
    {
    }

    public void forEachKeyValue(DoubleObjectProcedure procedure)
    {
    }

    public ImmutableDoubleObjectMap select(DoubleObjectPredicate predicate)
    {
        return this;
    }

    public ImmutableDoubleObjectMap reject(DoubleObjectPredicate predicate)
    {
        return this;
    }

    public ImmutableDoubleObjectMap toImmutable()
    {
        return this;
    }

    public int size()
    {
        return 0;
    }

    public boolean isEmpty()
    {
        return true;
    }

    public boolean notEmpty()
    {
        return false;
    }

    public V getFirst()
    {
        return null;
    }

    public V getLast()
    {
        return null;
    }

    public boolean contains(Object object)
    {
        return false;
    }

    public boolean containsAllIterable(Iterable source)
    {
        return !source.iterator().hasNext();
    }

    public boolean containsAll(Collection source)
    {
        return source.isEmpty();
    }

    public boolean containsAllArguments(Object... elements)
    {
        return elements.length == 0;
    }

    public ImmutableCollection select(Predicate predicate)
    {
        return Lists.immutable.with();
    }

    public > R select(Predicate predicate, R target)
    {
        return target;
    }

    public 

ImmutableCollection selectWith(Predicate2 predicate, P parameter) { return Lists.immutable.with(); } public > R selectWith(Predicate2 predicate, P parameter, R targetCollection) { return targetCollection; } public ImmutableCollection reject(Predicate predicate) { return Lists.immutable.with(); } public > R reject(Predicate predicate, R target) { return target; } public

ImmutableCollection rejectWith(Predicate2 predicate, P parameter) { return Lists.immutable.with(); } public > R rejectWith(Predicate2 predicate, P parameter, R targetCollection) { return targetCollection; } public PartitionIterable partition(Predicate predicate) { return new PartitionFastList(); } public

PartitionIterable partitionWith(Predicate2 predicate, P parameter) { return new PartitionFastList(); } public RichIterable selectInstancesOf(Class clazz) { return Lists.mutable.with(); } public ImmutableCollection collect(Function function) { return Lists.immutable.with(); } public ImmutableBooleanCollection collectBoolean(BooleanFunction booleanFunction) { return BooleanLists.immutable.with(); } public R collectBoolean(BooleanFunction booleanFunction, R target) { return target; } public ImmutableByteCollection collectByte(ByteFunction byteFunction) { return ByteLists.immutable.with(); } public R collectByte(ByteFunction byteFunction, R target) { return target; } public ImmutableCharCollection collectChar(CharFunction charFunction) { return CharLists.immutable.with(); } public R collectChar(CharFunction charFunction, R target) { return target; } public ImmutableDoubleCollection collectDouble(DoubleFunction doubleFunction) { return DoubleLists.immutable.with(); } public R collectDouble(DoubleFunction doubleFunction, R target) { return target; } public ImmutableFloatCollection collectFloat(FloatFunction floatFunction) { return FloatLists.immutable.with(); } public R collectFloat(FloatFunction floatFunction, R target) { return target; } public ImmutableIntCollection collectInt(IntFunction intFunction) { return IntLists.immutable.with(); } public R collectInt(IntFunction intFunction, R target) { return target; } public ImmutableLongCollection collectLong(LongFunction longFunction) { return LongLists.immutable.with(); } public R collectLong(LongFunction longFunction, R target) { return target; } public ImmutableShortCollection collectShort(ShortFunction shortFunction) { return ShortLists.immutable.with(); } public R collectShort(ShortFunction shortFunction, R target) { return target; } public RichIterable collectIf(Predicate predicate, Function function) { return Lists.mutable.with(); } public RichIterable flatCollect(Function> function) { return Lists.mutable.with(); } public V detect(Predicate predicate) { return null; } public

V detectWith(Predicate2 predicate, P parameter) { return null; } public V detectIfNone(Predicate predicate, Function0 function) { return function.value(); } public

V detectWithIfNone(Predicate2 predicate, P parameter, Function0 function) { return function.value(); } public int count(Predicate predicate) { return 0; } public

int countWith(Predicate2 predicate, P parameter) { return 0; } public boolean anySatisfy(Predicate predicate) { return false; } public

boolean anySatisfyWith(Predicate2 predicate, P parameter) { return false; } public boolean allSatisfy(Predicate predicate) { return true; } public

boolean allSatisfyWith(Predicate2 predicate, P parameter) { return true; } public boolean noneSatisfy(Predicate predicate) { return true; } public

boolean noneSatisfyWith(Predicate2 predicate, P parameter) { return true; } public IV injectInto(IV injectedValue, Function2 function) { return injectedValue; } public int injectInto(int injectedValue, IntObjectToIntFunction function) { return injectedValue; } public long injectInto(long injectedValue, LongObjectToLongFunction function) { return injectedValue; } public float injectInto(float injectedValue, FloatObjectToFloatFunction function) { return injectedValue; } public double injectInto(double injectedValue, DoubleObjectToDoubleFunction function) { return injectedValue; } public MutableList toList() { return Lists.mutable.with(); } public MutableList toSortedList() { return Lists.mutable.with(); } public MutableList toSortedList(Comparator comparator) { return Lists.mutable.with(); } public MutableSet toSet() { return Sets.mutable.with(); } public MutableSortedSet toSortedSet() { return SortedSets.mutable.with(); } public MutableSortedSet toSortedSet(Comparator comparator) { return SortedSets.mutable.with(); } public MutableBag toBag() { return Bags.mutable.with(); } public MutableMap toMap(Function keyFunction, Function valueFunction) { return Maps.mutable.with(); } public MutableSortedMap toSortedMap(Function keyFunction, Function valueFunction) { return SortedMaps.mutable.with(); } public MutableSortedMap toSortedMap(Comparator comparator, Function keyFunction, Function valueFunction) { return SortedMaps.mutable.with(); } public LazyIterable asLazy() { return new LazyIterableAdapter(FastList.newListWith()); } public Object[] toArray() { return new Object[0]; } public T[] toArray(T[] a) { return (T[]) new Object[0]; } public V min(Comparator comparator) { throw new NoSuchElementException(); } public V max(Comparator comparator) { throw new NoSuchElementException(); } public V min() { throw new NoSuchElementException(); } public V max() { throw new NoSuchElementException(); } public long sumOfInt(IntFunction function) { return 0L; } public double sumOfFloat(FloatFunction function) { return 0.0; } public long sumOfLong(LongFunction function) { return 0L; } public double sumOfDouble(DoubleFunction function) { return 0.0; } public MutableDoubleSet keySet() { return UnmodifiableDoubleSet.of(DoubleHashSet.newSetWith()); } public Collection values() { return Lists.immutable.of().castToList(); } public LazyDoubleIterable keysView() { return LazyDoubleIterate.empty(); } public RichIterable> keyValuesView() { return LazyIterate.empty(); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof DoubleObjectMap)) { return false; } DoubleObjectMap map = (DoubleObjectMap) obj; return map.isEmpty(); } @Override public int hashCode() { return 0; } @Override public String toString() { return "{}"; } public String makeString() { return ""; } public String makeString(String separator) { return ""; } public String makeString(String start, String separator, String end) { return start + end; } public void appendString(Appendable appendable) { } public void appendString(Appendable appendable, String separator) { } 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); } } public Multimap groupBy(Function function) { return FastListMultimap.newMultimap(); } public Multimap groupByEach(Function> function) { return FastListMultimap.newMultimap(); } public MapIterable groupByUniqueKey(Function function) { throw new UnsupportedOperationException(this.getClass().getSimpleName() + ".groupByUniqueKey() not implemented yet"); } public RichIterable> zip(Iterable that) { return Lists.immutable.of(); } public >> R zip(Iterable that, R target) { return target; } public RichIterable> zipWithIndex() { return Lists.immutable.of(); } public >> R zipWithIndex(R target) { return target; } public RichIterable> chunk(int size) { return Lists.immutable.of(); } public MapIterable aggregateInPlaceBy(Function groupBy, Function0 zeroValueFactory, Procedure2 mutatingAggregator) { return Maps.immutable.with(); } public MapIterable aggregateBy(Function groupBy, Function0 zeroValueFactory, Function2 nonMutatingAggregator) { return Maps.immutable.with(); } public > R groupByEach(Function> function, R target) { return target; } public > R groupBy(Function function, R target) { return target; } public > V maxBy(Function function) { throw new NoSuchElementException(); } public > V minBy(Function function) { throw new NoSuchElementException(); } public > MutableSortedSet toSortedSetBy(Function function) { return SortedSets.mutable.of(); } public > MutableList toSortedListBy(Function function) { return Lists.mutable.of(); } public > R flatCollect(Function> function, R target) { return target; } public > R collectIf(Predicate predicate, Function function, R target) { return target; } public ImmutableCollection collectWith(Function2 function, P parameter) { return Lists.immutable.with(); } public > R collectWith(Function2 function, P parameter, R targetCollection) { return targetCollection; } public > R collect(Function function, R target) { return target; } public ImmutableDoubleObjectMap newWithKeyValue(double key, V value) { DoubleObjectHashMap map = new DoubleObjectHashMap(); map.put(key, value); return map.toImmutable(); } public ImmutableDoubleObjectMap newWithoutKey(double key) { return this; } public ImmutableDoubleObjectMap newWithoutAllKeys(DoubleIterable keys) { return this; } public void forEach(Procedure procedure) { } public void forEachWithIndex(ObjectIntProcedure objectIntProcedure) { } public

void forEachWith(Procedure2 procedure, P parameter) { } public Iterator iterator() { return new InternalIterator(); } private class InternalIterator implements Iterator { public boolean hasNext() { return false; } public V next() { throw new NoSuchElementException(); } public void remove() { throw new UnsupportedOperationException("Cannot call remove() on " + this.getClass().getSimpleName()); } } }