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

com.gs.collections.impl.bimap.AbstractBiMap Maven / Gradle / Ivy

Go to download

GS Collections is a collections framework for Java. It has JDK-compatible List, Set and Map implementations with a rich API and set of utility classes that work with any JDK compatible Collections, Arrays, Maps or Strings. The iteration protocol was inspired by the Smalltalk collection framework.

There is a newer version: 7.0.3
Show newest version
/*
 * 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.bimap;

import java.util.Collection;
import java.util.Comparator;
import java.util.Map;

import com.gs.collections.api.LazyIterable;
import com.gs.collections.api.RichIterable;
import com.gs.collections.api.bag.MutableBag;
import com.gs.collections.api.bag.sorted.MutableSortedBag;
import com.gs.collections.api.bimap.BiMap;
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.procedure.Procedure;
import com.gs.collections.api.block.procedure.Procedure2;
import com.gs.collections.api.block.procedure.primitive.ObjectIntProcedure;
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;
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.ObjectDoubleMap;
import com.gs.collections.api.map.primitive.ObjectLongMap;
import com.gs.collections.api.map.sorted.MutableSortedMap;
import com.gs.collections.api.multimap.MutableMultimap;
import com.gs.collections.api.set.MutableSet;
import com.gs.collections.api.set.sorted.MutableSortedSet;
import com.gs.collections.api.tuple.Pair;

public abstract class AbstractBiMap implements BiMap
{
    protected abstract MapIterable getDelegate();

    protected abstract MapIterable getInverse();

    @Override
    public boolean equals(Object obj)
    {
        if (this == obj)
        {
            return true;
        }
        if (!(obj instanceof Map))
        {
            return false;
        }

        Map map = (Map) obj;

        return this.getDelegate().equals(map);
    }

    @Override
    public int hashCode()
    {
        return this.getDelegate().hashCode();
    }

    public int size()
    {
        return this.getDelegate().size();
    }

    public V get(Object key)
    {
        return this.getDelegate().get(key);
    }

    public V getFirst()
    {
        return this.getDelegate().getFirst();
    }

    public V getLast()
    {
        return this.getDelegate().getLast();
    }

    public V getIfAbsent(K key, Function0 function)
    {
        return this.getDelegate().getIfAbsent(key, function);
    }

    public V getIfAbsentValue(K key, V value)
    {
        return this.getDelegate().getIfAbsentValue(key, value);
    }

    public 

V getIfAbsentWith(K key, Function function, P parameter) { return this.getDelegate().getIfAbsentWith(key, function, parameter); } public A ifPresentApply(K key, Function function) { return this.getDelegate().ifPresentApply(key, function); } public boolean isEmpty() { return this.getDelegate().isEmpty(); } public boolean notEmpty() { return this.getDelegate().notEmpty(); } public boolean contains(Object object) { return this.getInverse().containsKey(object); } public boolean containsKey(Object key) { return this.getDelegate().containsKey(key); } public boolean containsValue(Object value) { return this.getInverse().containsKey(value); } public boolean containsAllIterable(Iterable source) { return this.getInverse().keysView().containsAllIterable(source); } public boolean containsAll(Collection source) { return this.getInverse().keysView().containsAll(source); } public boolean containsAllArguments(Object... elements) { return this.getInverse().keysView().containsAllArguments(elements); } public RichIterable keysView() { return this.getDelegate().keysView(); } public RichIterable valuesView() { return this.getDelegate().valuesView(); } public RichIterable> keyValuesView() { return this.getDelegate().keyValuesView(); } public MutableList toList() { return this.getDelegate().toList(); } public MutableList toSortedList() { return this.getDelegate().toSortedList(); } public MutableList toSortedList(Comparator comparator) { return this.getDelegate().toSortedList(comparator); } public > MutableList toSortedListBy(Function function) { return this.getDelegate().toSortedListBy(function); } public MutableSet toSet() { return this.getDelegate().toSet(); } public MutableSortedSet toSortedSet() { return this.getDelegate().toSortedSet(); } public MutableSortedSet toSortedSet(Comparator comparator) { return this.getDelegate().toSortedSet(comparator); } public > MutableSortedSet toSortedSetBy(Function function) { return this.getDelegate().toSortedSetBy(function); } public MutableBag toBag() { return this.getDelegate().toBag(); } public MutableSortedBag toSortedBag() { return this.getDelegate().toSortedBag(); } public MutableSortedBag toSortedBag(Comparator comparator) { return this.getDelegate().toSortedBag(comparator); } public > MutableSortedBag toSortedBagBy(Function function) { return this.getDelegate().toSortedBagBy(function); } public MutableMap toMap(Function keyFunction, Function valueFunction) { return this.getDelegate().toMap(keyFunction, valueFunction); } public MutableSortedMap toSortedMap(Function keyFunction, Function valueFunction) { return this.getDelegate().toSortedMap(keyFunction, valueFunction); } public MutableSortedMap toSortedMap(Comparator comparator, Function keyFunction, Function valueFunction) { return this.getDelegate().toSortedMap(comparator, keyFunction, valueFunction); } public Object[] toArray() { return this.getDelegate().toArray(); } public T[] toArray(T[] a) { return this.getDelegate().toArray(a); } @Override public String toString() { return this.getDelegate().toString(); } public String makeString() { return this.getDelegate().makeString(); } public String makeString(String separator) { return this.getDelegate().makeString(separator); } public String makeString(String start, String separator, String end) { return this.getDelegate().makeString(start, separator, end); } public void appendString(Appendable appendable) { this.getDelegate().appendString(appendable); } public void appendString(Appendable appendable, String separator) { this.getDelegate().appendString(appendable, separator); } public void appendString(Appendable appendable, String start, String separator, String end) { this.getDelegate().appendString(appendable, start, separator, end); } public void forEachValue(Procedure procedure) { this.getInverse().forEachKey(procedure); } public void forEachKey(Procedure procedure) { this.getDelegate().forEachKey(procedure); } public void forEachKeyValue(Procedure2 procedure) { this.getDelegate().forEachKeyValue(procedure); } public void each(Procedure procedure) { this.getInverse().forEachKey(procedure); } public void forEach(Procedure procedure) { this.each(procedure); } public void forEachWithIndex(ObjectIntProcedure objectIntProcedure) { this.getDelegate().forEachWithIndex(objectIntProcedure); } public

void forEachWith(Procedure2 procedure, P parameter) { this.getDelegate().forEachWith(procedure, parameter); } public LazyIterable asLazy() { return this.getDelegate().asLazy(); } public int count(Predicate predicate) { return this.getDelegate().count(predicate); } public

int countWith(Predicate2 predicate, P parameter) { return this.getDelegate().countWith(predicate, parameter); } public V min(Comparator comparator) { return this.getDelegate().min(comparator); } public V min() { return this.getDelegate().min(); } public > V minBy(Function function) { return this.getDelegate().minBy(function); } public V max(Comparator comparator) { return this.getDelegate().max(comparator); } public V max() { return this.getDelegate().max(); } public > V maxBy(Function function) { return this.getDelegate().maxBy(function); } public Pair detect(Predicate2 predicate) { return this.getDelegate().detect(predicate); } public V detect(Predicate predicate) { return this.getDelegate().detect(predicate); } public

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

V detectWithIfNone(Predicate2 predicate, P parameter, Function0 function) { return this.getDelegate().detectWithIfNone(predicate, parameter, function); } public boolean anySatisfy(Predicate predicate) { return this.getDelegate().anySatisfy(predicate); } public

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

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

boolean noneSatisfyWith(Predicate2 predicate, P parameter) { return this.getDelegate().noneSatisfyWith(predicate, parameter); } public > R collect(Function function, R target) { return this.getDelegate().collect(function, target); } public R collectBoolean(BooleanFunction booleanFunction, R target) { return this.getDelegate().collectBoolean(booleanFunction, target); } public R collectByte(ByteFunction byteFunction, R target) { return this.getDelegate().collectByte(byteFunction, target); } public R collectChar(CharFunction charFunction, R target) { return this.getDelegate().collectChar(charFunction, target); } public R collectDouble(DoubleFunction doubleFunction, R target) { return this.getDelegate().collectDouble(doubleFunction, target); } public R collectFloat(FloatFunction floatFunction, R target) { return this.getDelegate().collectFloat(floatFunction, target); } public R collectInt(IntFunction intFunction, R target) { return this.getDelegate().collectInt(intFunction, target); } public R collectLong(LongFunction longFunction, R target) { return this.getDelegate().collectLong(longFunction, target); } public R collectShort(ShortFunction shortFunction, R target) { return this.getDelegate().collectShort(shortFunction, target); } public > R collectWith(Function2 function, P parameter, R targetCollection) { return this.getDelegate().collectWith(function, parameter, targetCollection); } public > R collectIf(Predicate predicate, Function function, R target) { return this.getDelegate().collectIf(predicate, function, target); } public > R flatCollect(Function> function, R target) { return this.getDelegate().flatCollect(function, target); } public > R select(Predicate predicate, R target) { return this.getDelegate().select(predicate, target); } public > R selectWith(Predicate2 predicate, P parameter, R targetCollection) { return this.getDelegate().selectWith(predicate, parameter, targetCollection); } public > R reject(Predicate predicate, R target) { return this.getDelegate().reject(predicate, target); } public > R rejectWith(Predicate2 predicate, P parameter, R targetCollection) { return this.getDelegate().rejectWith(predicate, parameter, targetCollection); } public >> R zip(Iterable that, R target) { return this.getDelegate().zip(that, target); } public >> R zipWithIndex(R target) { return this.getDelegate().zipWithIndex(target); } public RichIterable> chunk(int size) { return this.getDelegate().chunk(size); } public > R groupBy(Function function, R target) { return this.getDelegate().groupBy(function, target); } public > R groupByEach(Function> function, R target) { return this.getDelegate().groupByEach(function, target); } public > R groupByUniqueKey(Function function, R target) { return this.getDelegate().groupByUniqueKey(function, target); } public IV injectInto(IV injectedValue, Function2 function) { return this.getDelegate().injectInto(injectedValue, function); } public int injectInto(int injectedValue, IntObjectToIntFunction function) { return this.getDelegate().injectInto(injectedValue, function); } public long injectInto(long injectedValue, LongObjectToLongFunction function) { return this.getDelegate().injectInto(injectedValue, function); } public float injectInto(float injectedValue, FloatObjectToFloatFunction function) { return this.getDelegate().injectInto(injectedValue, function); } public double injectInto(double injectedValue, DoubleObjectToDoubleFunction function) { return this.getDelegate().injectInto(injectedValue, function); } public long sumOfInt(IntFunction function) { return this.getDelegate().sumOfInt(function); } public double sumOfFloat(FloatFunction function) { return this.getDelegate().sumOfFloat(function); } public long sumOfLong(LongFunction function) { return this.getDelegate().sumOfLong(function); } public double sumOfDouble(DoubleFunction function) { return this.getDelegate().sumOfDouble(function); } public ObjectLongMap sumByInt(Function groupBy, IntFunction function) { return this.getDelegate().sumByInt(groupBy, function); } public ObjectDoubleMap sumByFloat(Function groupBy, FloatFunction function) { return this.getDelegate().sumByFloat(groupBy, function); } public ObjectLongMap sumByLong(Function groupBy, LongFunction function) { return this.getDelegate().sumByLong(groupBy, function); } public ObjectDoubleMap sumByDouble(Function groupBy, DoubleFunction function) { return this.getDelegate().sumByDouble(groupBy, function); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy