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

org.eclipse.collections.api.bimap.MutableBiMap Maven / Gradle / Ivy

There is a newer version: 12.0.0.M3
Show newest version
/*
 * Copyright (c) 2015 Goldman Sachs.
 * 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.api.bimap;

import java.util.Map;

import org.eclipse.collections.api.block.function.Function;
import org.eclipse.collections.api.block.function.Function2;
import org.eclipse.collections.api.block.predicate.Predicate;
import org.eclipse.collections.api.block.predicate.Predicate2;
import org.eclipse.collections.api.block.procedure.Procedure;
import org.eclipse.collections.api.map.MutableMapIterable;
import org.eclipse.collections.api.multimap.set.MutableSetMultimap;
import org.eclipse.collections.api.partition.set.PartitionMutableSet;
import org.eclipse.collections.api.set.MutableSet;
import org.eclipse.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); }