Top Description Inners Fields Constructors Methods
org.eclipse.collections.impl.multimap.bag

public final Class ImmutableBagMultimapImpl<K, V>

extends AbstractImmutableMultimap<K, V, ImmutableBag<V>>
implements ImmutableBagMultimap<K, V>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap, org.eclipse.collections.api.multimap.bag.ImmutableBagIterableMultimap, org.eclipse.collections.api.multimap.bag.BagMultimap, org.eclipse.collections.api.multimap.Multimap, org.eclipse.collections.api.multimap.ImmutableMultimap, org.eclipse.collections.api.multimap.bag.UnsortedBagMultimap
Imports
java.io.Externalizable, .IOException, .ObjectInput, .ObjectOutput, .Serializable, org.eclipse.collections.api.RichIterable, org.eclipse.collections.api.bag.ImmutableBag, .MutableBag, org.eclipse.collections.api.block.function.Function, .Function2, org.eclipse.collections.api.block.predicate.Predicate2, org.eclipse.collections.api.block.procedure.Procedure2, org.eclipse.collections.api.factory.Bags, .Maps, org.eclipse.collections.api.map.ImmutableMap, .MutableMap, org.eclipse.collections.api.multimap.MutableMultimap, org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap, .MutableBagMultimap, org.eclipse.collections.api.tuple.Pair, org.eclipse.collections.impl.block.procedure.checked.CheckedObjectIntProcedure, .CheckedProcedure2, org.eclipse.collections.impl.multimap.AbstractImmutableMultimap, org.eclipse.collections.impl.utility.Iterate

The default ImmutableBagMultimap implementation.
Since
1.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final long
Inherited from org.eclipse.collections.impl.multimap.AbstractImmutableMultimap:
map

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public <K2, V2> ImmutableBagMultimap<K2, V2>
collectKeyMultiValues(Function<? super K, ? extends K2> keyFunction, Function<? super V, ? extends V2> valueFunction)

Implements org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap.collectKeyMultiValues, org.eclipse.collections.api.multimap.ImmutableMultimap.collectKeyMultiValues, org.eclipse.collections.api.multimap.Multimap.collectKeyMultiValues.

Returns a new multimap with the results of applying the specified keyFunction and valueFunction on each key and corresponding values of the source multimap.

public <K2, V2> ImmutableBagMultimap<K2, V2>
collectKeysValues(Function2<? super K, ? super V, Pair<K2, V2>> function)

Implements org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap.collectKeysValues, org.eclipse.collections.api.multimap.ImmutableMultimap.collectKeysValues, org.eclipse.collections.api.multimap.Multimap.collectKeysValues.

Returns a new multimap with the results of applying the specified function on each key and value of the source multimap.

public <V2> ImmutableBagMultimap<K, V2>
collectValues(Function<? super V, ? extends V2> function)

Implements org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap.collectValues, org.eclipse.collections.api.multimap.ImmutableMultimap.collectValues, org.eclipse.collections.api.multimap.Multimap.collectValues.

Returns a new multimap with the results of applying the specified function on each value of the source multimap.

protected ImmutableBag<V>
createCollection()

Implements abstract org.eclipse.collections.impl.multimap.AbstractMultimap.createCollection.

Creates the collection of values for a single key.

public ImmutableBagMultimap<V, K>
public void
public ImmutableBagMultimap<K, V>
public ImmutableBagMultimap<K, V>
public ImmutableBagMultimap<K, V>
public ImmutableBagMultimap<K, V>
public ImmutableBagMultimap<K, V>
public ImmutableBagMultimap<K, V>
public ImmutableBagMultimap<K, V>
public ImmutableBagMultimap<K, V>
public ImmutableBagMultimap<K, V>
public ImmutableBagMultimap<K, V>
public MutableBagMultimap<K, V>
private Object
Inherited from org.eclipse.collections.impl.multimap.AbstractImmutableMultimap:
getgetMapisEmptykeySetreadResolvesizesizeDistincttoMaptoMap

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

ImmutableBagMultimapImplback to summary
public ImmutableBagMultimapImpl(MutableMap<K, ImmutableBag<V>> map)
ImmutableBagMultimapImplback to summary
public ImmutableBagMultimapImpl(ImmutableMap<K, ImmutableBag<V>> map)

Method Detail

collectKeyMultiValuesback to summary
public <K2, V2> ImmutableBagMultimap<K2, V2> collectKeyMultiValues(Function<? super K, ? extends K2> keyFunction, Function<? super V, ? extends V2> valueFunction)

Implements org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap.collectKeyMultiValues, org.eclipse.collections.api.multimap.ImmutableMultimap.collectKeyMultiValues, org.eclipse.collections.api.multimap.Multimap.collectKeyMultiValues.

Doc from org.eclipse.collections.api.multimap.Multimap.collectKeyMultiValues.

Returns a new multimap with the results of applying the specified keyFunction and valueFunction on each key and corresponding values of the source multimap. This method is also commonly called transform or map.

e.g.
return multimap.collectKeyMultiValues(each -> each + 1, Person::getLastName);
Annotations
@Override
collectKeysValuesback to summary
public <K2, V2> ImmutableBagMultimap<K2, V2> collectKeysValues(Function2<? super K, ? super V, Pair<K2, V2>> function)

Implements org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap.collectKeysValues, org.eclipse.collections.api.multimap.ImmutableMultimap.collectKeysValues, org.eclipse.collections.api.multimap.Multimap.collectKeysValues.

Doc from org.eclipse.collections.api.multimap.Multimap.collectKeysValues.

Returns a new multimap with the results of applying the specified function on each key and value of the source multimap. This method is also commonly called transform or map.

e.g.
return multimap.collectKeysValues(new Function2<Integer, Person, Pair<String, String>>()
{
    public Pair<String, String> valueOf(Integer age, Person person)
    {
        return Tuples.pair(age.toString(), person.getLastName());
    }
});
Annotations
@Override
collectValuesback to summary
public <V2> ImmutableBagMultimap<K, V2> collectValues(Function<? super V, ? extends V2> function)

Implements org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap.collectValues, org.eclipse.collections.api.multimap.ImmutableMultimap.collectValues, org.eclipse.collections.api.multimap.Multimap.collectValues.

Doc from org.eclipse.collections.api.multimap.Multimap.collectValues.

Returns a new multimap with the results of applying the specified function on each value of the source multimap. This method is also commonly called transform or map.

e.g.
return multimap.collectValues(new Function<Person, String>()
{
    public String valueOf(Person person)
    {
        return person.getLastName();
    }
});
Annotations
@Override
createCollectionback to summary
protected ImmutableBag<V> createCollection()

Implements abstract org.eclipse.collections.impl.multimap.AbstractMultimap.createCollection.

Doc from org.eclipse.collections.impl.multimap.AbstractMultimap.createCollection.

Creates the collection of values for a single key.

Collections with weak, soft, or phantom references are not supported. Each call to createCollection should create a new instance.

The returned collection class determines whether duplicate key-value pairs are allowed.

Annotations
@Override
flipback to summary
public ImmutableBagMultimap<V, K> flip()

Implements org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap.flip, org.eclipse.collections.api.multimap.ImmutableMultimap.flip, org.eclipse.collections.api.multimap.Multimap.flip.

Doc from org.eclipse.collections.api.multimap.Multimap.flip.

Given a Multimap from Domain -> Range return a multimap from Range -> Domain.

Annotations
@Override
forEachKeyImmutableBagback to summary
public void forEachKeyImmutableBag(Procedure2<? super K, ? super ImmutableBag<V>> procedure)

Implements org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap.forEachKeyImmutableBag.

Annotations
@Override
newEmptyback to summary
public ImmutableBagMultimap<K, V> newEmpty()

Implements org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap.newEmpty, org.eclipse.collections.api.multimap.ImmutableMultimap.newEmpty, org.eclipse.collections.api.multimap.Multimap.newEmpty.

Doc from org.eclipse.collections.api.multimap.Multimap.newEmpty.

Creates a new instance of the same implementation type, using the default capacity and growth parameters.

Annotations
@Override
newWithback to summary
public ImmutableBagMultimap<K, V> newWith(K key, V value)

Overrides default org.eclipse.collections.api.multimap.ImmutableMultimap.newWith.

Implements org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap.newWith.

Annotations
@Override
newWithAllback to summary
public ImmutableBagMultimap<K, V> newWithAll(K key, Iterable<? extends V> values)

Overrides default org.eclipse.collections.api.multimap.ImmutableMultimap.newWithAll.

Implements org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap.newWithAll.

Annotations
@Override
newWithoutback to summary
public ImmutableBagMultimap<K, V> newWithout(Object key, Object value)

Overrides default org.eclipse.collections.api.multimap.ImmutableMultimap.newWithout.

Implements org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap.newWithout.

Annotations
@Override
newWithoutAllback to summary
public ImmutableBagMultimap<K, V> newWithoutAll(Object key)

Overrides default org.eclipse.collections.api.multimap.ImmutableMultimap.newWithoutAll.

Implements org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap.newWithoutAll.

Annotations
@Override
rejectKeysMultiValuesback to summary
public ImmutableBagMultimap<K, V> rejectKeysMultiValues(Predicate2<? super K, ? super RichIterable<V>> predicate)

Implements org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap.rejectKeysMultiValues, org.eclipse.collections.api.multimap.ImmutableMultimap.rejectKeysMultiValues, org.eclipse.collections.api.multimap.Multimap.rejectKeysMultiValues.

Doc from org.eclipse.collections.api.multimap.Multimap.rejectKeysMultiValues.

Returns all elements of the source multimap that don't satisfy the predicate.

e.g.
return multimap.rejectKeysMultiValues(new Predicate2<Integer, Iterable<Person>>()
{
    public boolean accept(Integer age, Iterable<Person> values)
    {
        return (age >= 18)
                 && ((RichIterable<Person>)values.size() >= 2);
    }
});
Annotations
@Override
rejectKeysValuesback to summary
public ImmutableBagMultimap<K, V> rejectKeysValues(Predicate2<? super K, ? super V> predicate)

Implements org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap.rejectKeysValues, org.eclipse.collections.api.multimap.ImmutableMultimap.rejectKeysValues, org.eclipse.collections.api.multimap.Multimap.rejectKeysValues.

Doc from org.eclipse.collections.api.multimap.Multimap.rejectKeysValues.

Returns all elements of the source multimap that don't satisfy the predicate.

e.g.
return multimap.rejectKeysValues(new Predicate2<Integer, Person>()
{
    public boolean accept(Integer age, Person person)
    {
        return (age >= 18)
                 && (person.getAddress().getCity().equals("Metuchen"));
    }
});
Annotations
@Override
selectKeysMultiValuesback to summary
public ImmutableBagMultimap<K, V> selectKeysMultiValues(Predicate2<? super K, ? super RichIterable<V>> predicate)

Implements org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap.selectKeysMultiValues, org.eclipse.collections.api.multimap.ImmutableMultimap.selectKeysMultiValues, org.eclipse.collections.api.multimap.Multimap.selectKeysMultiValues.

Doc from org.eclipse.collections.api.multimap.Multimap.selectKeysMultiValues.

Returns all elements of the source multimap that satisfies the predicate. This method is also commonly called filter.

e.g.
return multimap.selectKeysMultiValues(new Predicate2<Integer, Iterable<Person>>()
{
    public boolean accept(Integer age, Iterable<Person> values)
    {
        return (age >= 18)
                 && ((RichIterable<Person>)values.size() >= 2);
    }
});
Annotations
@Override
selectKeysValuesback to summary
public ImmutableBagMultimap<K, V> selectKeysValues(Predicate2<? super K, ? super V> predicate)

Implements org.eclipse.collections.api.multimap.bag.ImmutableBagMultimap.selectKeysValues, org.eclipse.collections.api.multimap.ImmutableMultimap.selectKeysValues, org.eclipse.collections.api.multimap.Multimap.selectKeysValues.

Doc from org.eclipse.collections.api.multimap.Multimap.selectKeysValues.

Returns all elements of the source multimap that satisfies the predicate. This method is also commonly called filter.

e.g.
return multimap.selectKeysValues(new Predicate2<Integer, Person>()
{
    public boolean accept(Integer age, Person person)
    {
        return (age >= 18)
                 && (person.getAddress().getCity().equals("Metuchen"));
    }
});
Annotations
@Override
toImmutableback to summary
public ImmutableBagMultimap<K, V> toImmutable()

Overrides org.eclipse.collections.impl.multimap.AbstractImmutableMultimap.toImmutable.

Implements org.eclipse.collections.api.multimap.bag.UnsortedBagMultimap.toImmutable, org.eclipse.collections.api.multimap.Multimap.toImmutable.

Doc from org.eclipse.collections.api.multimap.Multimap.toImmutable.

Returns an immutable copy of this Multimap if it is not already immutable. If the Multimap is immutable, it will return itself.

The returned Multimap will be Serializable if this Multimap is Serializable.

Annotations
@Override
toMutableback to summary
public MutableBagMultimap<K, V> toMutable()

Implements org.eclipse.collections.api.multimap.bag.UnsortedBagMultimap.toMutable, org.eclipse.collections.api.multimap.Multimap.toMutable.

Doc from org.eclipse.collections.api.multimap.Multimap.toMutable.

Returns a mutable copy of this Multimap.

Annotations
@Override
writeReplaceback to summary
private Object writeReplace()
org.eclipse.collections.impl.multimap.bag back to summary

private Class ImmutableBagMultimapImpl.ImmutableBagMultimapSerializationProxy<K, V>

extends Object
implements Externalizable
Class Inheritance
  • java.lang.Object
  • org.eclipse.collections.impl.multimap.bag.ImmutableBagMultimapImpl.ImmutableBagMultimapSerializationProxy
All Implemented Interfaces
java.io.Externalizable, java.io.Serializable

Field Summary

Modifier and TypeField and Description
private ImmutableMap<K, ImmutableBag<V>>
private MutableMultimap<K, V>
private static final long

Constructor Summary

AccessConstructor and Description
public
private

Method Summary

Modifier and TypeMethod and Description
public void
readExternal(ObjectInput in)

Implements java.io.Externalizable.readExternal.

The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.

protected Object
public void
writeExternal(ObjectOutput out)

Implements java.io.Externalizable.writeExternal.

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mapback to summary
private ImmutableMap<K, ImmutableBag<V>> map
multimapback to summary
private MutableMultimap<K, V> multimap
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

ImmutableBagMultimapSerializationProxyback to summary
public ImmutableBagMultimapSerializationProxy()
ImmutableBagMultimapSerializationProxyback to summary
private ImmutableBagMultimapSerializationProxy(ImmutableMap<K, ImmutableBag<V>> map)

Method Detail

readExternalback to summary
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException

Implements java.io.Externalizable.readExternal.

Doc from java.io.Externalizable.readExternal.

The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.

Annotations
@Override
Exceptions
IOException:
if I/O errors occur
ClassNotFoundException:
If the class for an object being restored cannot be found.
readResolveback to summary
protected Object readResolve()
writeExternalback to summary
public void writeExternal(ObjectOutput out) throws IOException

Implements java.io.Externalizable.writeExternal.

Doc from java.io.Externalizable.writeExternal.

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Annotations
@Override
Exceptions
IOException:
Includes any I/O exceptions that may occur