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

com.gs.collections.api.bimap.MutableBiMap Maven / Gradle / Ivy

/*
 * Copyright 2015 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.api.bimap;

import java.util.Map;

import com.gs.collections.api.block.function.Function;
import com.gs.collections.api.block.function.Function2;
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.map.MutableMapIterable;
import com.gs.collections.api.multimap.set.MutableSetMultimap;
import com.gs.collections.api.partition.set.PartitionMutableSet;
import com.gs.collections.api.set.MutableSet;
import com.gs.collections.api.tuple.Pair;

/**
 * A {@link BiMap} whose contents can be altered after initialization.
 *
 * @since 4.2
 */
public interface MutableBiMap extends BiMap, MutableMapIterable, Cloneable
{
    MutableBiMap newEmpty();

    MutableBiMap inverse();

    MutableBiMap flipUniqueValues();

    MutableSetMultimap flip();

    /**
     * Similar to {@link Map#put(Object, Object)}, except that it throws on the addition of a duplicate value.
     *
     * @throws IllegalArgumentException if the value already exists in the bimap.
     */
    V put(K key, V value);

    /**
     * Similar to {@link #put(Object, Object)}, except that it quietly removes any existing entry with the same
     * value before putting the key-value pair.
     */
    V forcePut(K key, V value);

    MutableBiMap asSynchronized();

    MutableBiMap asUnmodifiable();

    MutableBiMap clone();

    MutableBiMap tap(Procedure procedure);

    MutableBiMap select(Predicate2 predicate);

    MutableBiMap reject(Predicate2 predicate);

     MutableBiMap collect(Function2> function);

     MutableBiMap collectValues(Function2 function);

    MutableSet select(Predicate predicate);

    

MutableSet selectWith(Predicate2 predicate, P parameter); MutableSet reject(Predicate predicate);

MutableSet rejectWith(Predicate2 predicate, P parameter); PartitionMutableSet partition(Predicate predicate);

PartitionMutableSet partitionWith(Predicate2 predicate, P parameter); MutableSet selectInstancesOf(Class clazz); MutableSet> zip(Iterable that); MutableSet> zipWithIndex(); MutableSetMultimap groupBy(Function function); MutableSetMultimap groupByEach(Function> function); MutableBiMap groupByUniqueKey(Function function); MutableBiMap withKeyValue(K key, V value); MutableBiMap withAllKeyValues(Iterable> keyValues); MutableBiMap withAllKeyValueArguments(Pair... keyValuePairs); MutableBiMap withoutKey(K key); MutableBiMap withoutAllKeys(Iterable keys); }