public final class TreeBagMultimap<K,V> extends AbstractMutableMultimap<K,V,com.gs.collections.api.bag.sorted.MutableSortedBag<V>> implements com.gs.collections.api.multimap.sortedbag.MutableSortedBagMultimap<K,V>, java.io.Externalizable
map, totalSize| Constructor and Description |
|---|
TreeBagMultimap() |
TreeBagMultimap(java.util.Comparator<? super V> comparator) |
TreeBagMultimap(java.lang.Iterable<com.gs.collections.api.tuple.Pair<K,V>> inputIterable) |
TreeBagMultimap(com.gs.collections.api.multimap.Multimap<? extends K,? extends V> multimap) |
TreeBagMultimap(com.gs.collections.api.tuple.Pair<K,V>... pairs) |
| Modifier and Type | Method and Description |
|---|---|
<K2,V2> HashBagMultimap<K2,V2> |
collectKeysValues(com.gs.collections.api.block.function.Function2<? super K,? super V,com.gs.collections.api.tuple.Pair<K2,V2>> function)
Returns a new multimap with the results of applying the specified function on each key and value of the source
multimap.
|
<V2> FastListMultimap<K,V2> |
collectValues(com.gs.collections.api.block.function.Function<? super V,? extends V2> function)
Returns a new multimap with the results of applying the specified function on each value of the source
multimap.
|
java.util.Comparator<? super V> |
comparator() |
protected com.gs.collections.api.bag.sorted.MutableSortedBag<V> |
createCollection()
Creates the collection of values for a single key.
|
protected com.gs.collections.api.map.MutableMap<K,com.gs.collections.api.bag.sorted.MutableSortedBag<V>> |
createMap() |
protected com.gs.collections.api.map.MutableMap<K,com.gs.collections.api.bag.sorted.MutableSortedBag<V>> |
createMapWithKeyCount(int keyCount) |
com.gs.collections.api.multimap.bag.MutableBagMultimap<V,K> |
flip()
Given a Multimap from Domain -> Range return a multimap from Range -> Domain.
|
TreeBagMultimap<K,V> |
newEmpty()
Creates a new instance of the same implementation type, using the default capacity and growth parameters.
|
static <K,V> TreeBagMultimap<K,V> |
newMultimap() |
static <K,V> TreeBagMultimap<K,V> |
newMultimap(java.util.Comparator<? super V> comparator) |
static <K,V> TreeBagMultimap<K,V> |
newMultimap(java.lang.Iterable<com.gs.collections.api.tuple.Pair<K,V>> inputIterable) |
static <K,V> TreeBagMultimap<K,V> |
newMultimap(com.gs.collections.api.multimap.Multimap<? extends K,? extends V> multimap) |
static <K,V> TreeBagMultimap<K,V> |
newMultimap(com.gs.collections.api.tuple.Pair<K,V>... pairs) |
void |
readExternal(java.io.ObjectInput in) |
TreeBagMultimap<K,V> |
rejectKeysMultiValues(com.gs.collections.api.block.predicate.Predicate2<? super K,? super java.lang.Iterable<V>> predicate)
Returns all elements of the source multimap that don't satisfy the predicate.
|
TreeBagMultimap<K,V> |
rejectKeysValues(com.gs.collections.api.block.predicate.Predicate2<? super K,? super V> predicate)
Returns all elements of the source multimap that don't satisfy the predicate.
|
TreeBagMultimap<K,V> |
selectKeysMultiValues(com.gs.collections.api.block.predicate.Predicate2<? super K,? super java.lang.Iterable<V>> predicate)
Returns all elements of the source multimap that satisfies the predicate.
|
TreeBagMultimap<K,V> |
selectKeysValues(com.gs.collections.api.block.predicate.Predicate2<? super K,? super V> predicate)
Returns all elements of the source multimap that satisfies the predicate.
|
com.gs.collections.api.multimap.sortedbag.ImmutableSortedBagMultimap<K,V> |
toImmutable()
Returns an immutable copy of this Multimap if it is not already immutable.
|
com.gs.collections.api.multimap.sortedbag.MutableSortedBagMultimap<K,V> |
toMutable()
Returns a mutable copy of this Multimap.
|
void |
writeExternal(java.io.ObjectOutput out) |
add, addToTotalSize, clear, clearTotalSize, decrementTotalSize, get, getMap, incrementTotalSize, isEmpty, put, putAll, putAll, putAllPairs, remove, removeAll, replaceValues, size, sizeDistinct, subtractFromTotalSize, toMap, toMapcollectKeysValues, collectValues, containsKey, containsKeyAndValue, containsValue, createCollectionBlock, equals, forEachKey, forEachKeyMultiValues, forEachKeyValue, forEachValue, hashCode, keyBag, keyMultiValuePairsView, keysView, keyValuePairsView, multiValuesView, notEmpty, rejectKeysMultiValues, rejectKeysValues, selectKeysMultiValues, selectKeysValues, toString, valuesViewclone, finalize, getClass, notify, notifyAll, wait, wait, waitget, removeAll, replaceValuesadd, clear, put, putAll, putAll, putAllPairs, removecollectKeysValues, collectValues, containsKey, containsKeyAndValue, containsValue, equals, forEachKey, forEachKeyMultiValues, forEachKeyValue, forEachValue, hashCode, isEmpty, keyBag, keyMultiValuePairsView, keysView, keyValuePairsView, multiValuesView, notEmpty, rejectKeysMultiValues, rejectKeysValues, selectKeysMultiValues, selectKeysValues, size, sizeDistinct, toMap, toMap, valuesViewpublic TreeBagMultimap()
public TreeBagMultimap(java.util.Comparator<? super V> comparator)
public TreeBagMultimap(com.gs.collections.api.multimap.Multimap<? extends K,? extends V> multimap)
public static <K,V> TreeBagMultimap<K,V> newMultimap()
public static <K,V> TreeBagMultimap<K,V> newMultimap(com.gs.collections.api.multimap.Multimap<? extends K,? extends V> multimap)
public static <K,V> TreeBagMultimap<K,V> newMultimap(java.util.Comparator<? super V> comparator)
public static <K,V> TreeBagMultimap<K,V> newMultimap(com.gs.collections.api.tuple.Pair<K,V>... pairs)
public static <K,V> TreeBagMultimap<K,V> newMultimap(java.lang.Iterable<com.gs.collections.api.tuple.Pair<K,V>> inputIterable)
protected com.gs.collections.api.map.MutableMap<K,com.gs.collections.api.bag.sorted.MutableSortedBag<V>> createMap()
createMap in class AbstractMutableMultimap<K,V,com.gs.collections.api.bag.sorted.MutableSortedBag<V>>protected com.gs.collections.api.map.MutableMap<K,com.gs.collections.api.bag.sorted.MutableSortedBag<V>> createMapWithKeyCount(int keyCount)
createMapWithKeyCount in class AbstractMutableMultimap<K,V,com.gs.collections.api.bag.sorted.MutableSortedBag<V>>protected com.gs.collections.api.bag.sorted.MutableSortedBag<V> createCollection()
AbstractMultimap
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.
createCollection in class AbstractMultimap<K,V,com.gs.collections.api.bag.sorted.MutableSortedBag<V>>public TreeBagMultimap<K,V> newEmpty()
com.gs.collections.api.multimap.MultimapnewEmpty in interface com.gs.collections.api.multimap.bag.BagMultimap<K,V>newEmpty in interface com.gs.collections.api.multimap.bag.MutableBagIterableMultimap<K,V>newEmpty in interface com.gs.collections.api.multimap.Multimap<K,V>newEmpty in interface com.gs.collections.api.multimap.MutableMultimap<K,V>newEmpty in interface com.gs.collections.api.multimap.ordered.OrderedIterableMultimap<K,V>newEmpty in interface com.gs.collections.api.multimap.ordered.ReversibleIterableMultimap<K,V>newEmpty in interface com.gs.collections.api.multimap.ordered.SortedIterableMultimap<K,V>newEmpty in interface com.gs.collections.api.multimap.sortedbag.MutableSortedBagMultimap<K,V>newEmpty in interface com.gs.collections.api.multimap.sortedbag.SortedBagMultimap<K,V>public java.util.Comparator<? super V> comparator()
public com.gs.collections.api.multimap.sortedbag.MutableSortedBagMultimap<K,V> toMutable()
com.gs.collections.api.multimap.Multimappublic com.gs.collections.api.multimap.sortedbag.ImmutableSortedBagMultimap<K,V> toImmutable()
com.gs.collections.api.multimap.Multimap
The returned Multimap will be Serializable if this Multimap is Serializable.
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.ExternalizablewriteExternal in class AbstractMutableMultimap<K,V,com.gs.collections.api.bag.sorted.MutableSortedBag<V>>java.io.IOExceptionpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.ExternalizablereadExternal in class AbstractMutableMultimap<K,V,com.gs.collections.api.bag.sorted.MutableSortedBag<V>>java.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic com.gs.collections.api.multimap.bag.MutableBagMultimap<V,K> flip()
com.gs.collections.api.multimap.Multimapflip in interface com.gs.collections.api.multimap.bag.BagMultimap<K,V>flip in interface com.gs.collections.api.multimap.bag.MutableBagIterableMultimap<K,V>flip in interface com.gs.collections.api.multimap.Multimap<K,V>flip in interface com.gs.collections.api.multimap.MutableMultimap<K,V>flip in interface com.gs.collections.api.multimap.sortedbag.MutableSortedBagMultimap<K,V>public TreeBagMultimap<K,V> selectKeysValues(com.gs.collections.api.block.predicate.Predicate2<? super K,? super V> predicate)
com.gs.collections.api.multimap.Multimap
e.g.
return multimap.selectKeysValues(new Predicate2<Integer, Person>()
{
public boolean accept(Integer age, Person person)
{
return (age >= 18)
&& (person.getAddress().getCity().equals("Metuchen"));
}
});
selectKeysValues in interface com.gs.collections.api.multimap.bag.BagMultimap<K,V>selectKeysValues in interface com.gs.collections.api.multimap.bag.MutableBagIterableMultimap<K,V>selectKeysValues in interface com.gs.collections.api.multimap.Multimap<K,V>selectKeysValues in interface com.gs.collections.api.multimap.MutableMultimap<K,V>selectKeysValues in interface com.gs.collections.api.multimap.ordered.OrderedIterableMultimap<K,V>selectKeysValues in interface com.gs.collections.api.multimap.ordered.ReversibleIterableMultimap<K,V>selectKeysValues in interface com.gs.collections.api.multimap.ordered.SortedIterableMultimap<K,V>selectKeysValues in interface com.gs.collections.api.multimap.sortedbag.MutableSortedBagMultimap<K,V>selectKeysValues in interface com.gs.collections.api.multimap.sortedbag.SortedBagMultimap<K,V>predicate - a Predicate2 to use as the select criteriaMultimap, which contains elements as a result of the select criteriapublic TreeBagMultimap<K,V> rejectKeysValues(com.gs.collections.api.block.predicate.Predicate2<? super K,? super V> predicate)
com.gs.collections.api.multimap.Multimap
e.g.
return multimap.rejectKeysValues(new Predicate2<Integer, Person>()
{
public boolean accept(Integer age, Person person)
{
return (age >= 18)
&& (person.getAddress().getCity().equals("Metuchen"));
}
});
rejectKeysValues in interface com.gs.collections.api.multimap.bag.BagMultimap<K,V>rejectKeysValues in interface com.gs.collections.api.multimap.bag.MutableBagIterableMultimap<K,V>rejectKeysValues in interface com.gs.collections.api.multimap.Multimap<K,V>rejectKeysValues in interface com.gs.collections.api.multimap.MutableMultimap<K,V>rejectKeysValues in interface com.gs.collections.api.multimap.ordered.OrderedIterableMultimap<K,V>rejectKeysValues in interface com.gs.collections.api.multimap.ordered.ReversibleIterableMultimap<K,V>rejectKeysValues in interface com.gs.collections.api.multimap.ordered.SortedIterableMultimap<K,V>rejectKeysValues in interface com.gs.collections.api.multimap.sortedbag.MutableSortedBagMultimap<K,V>rejectKeysValues in interface com.gs.collections.api.multimap.sortedbag.SortedBagMultimap<K,V>predicate - a Predicate2 to use as the reject criteriaMultimap, which contains elements that don't satisfy the predicatepublic TreeBagMultimap<K,V> selectKeysMultiValues(com.gs.collections.api.block.predicate.Predicate2<? super K,? super java.lang.Iterable<V>> predicate)
com.gs.collections.api.multimap.Multimap
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);
}
});
selectKeysMultiValues in interface com.gs.collections.api.multimap.bag.BagMultimap<K,V>selectKeysMultiValues in interface com.gs.collections.api.multimap.bag.MutableBagIterableMultimap<K,V>selectKeysMultiValues in interface com.gs.collections.api.multimap.Multimap<K,V>selectKeysMultiValues in interface com.gs.collections.api.multimap.MutableMultimap<K,V>selectKeysMultiValues in interface com.gs.collections.api.multimap.ordered.OrderedIterableMultimap<K,V>selectKeysMultiValues in interface com.gs.collections.api.multimap.ordered.ReversibleIterableMultimap<K,V>selectKeysMultiValues in interface com.gs.collections.api.multimap.ordered.SortedIterableMultimap<K,V>selectKeysMultiValues in interface com.gs.collections.api.multimap.sortedbag.MutableSortedBagMultimap<K,V>selectKeysMultiValues in interface com.gs.collections.api.multimap.sortedbag.SortedBagMultimap<K,V>predicate - a Predicate2 to use as the select criteriaMultimap, which contains elements as a result of the select criteriapublic TreeBagMultimap<K,V> rejectKeysMultiValues(com.gs.collections.api.block.predicate.Predicate2<? super K,? super java.lang.Iterable<V>> predicate)
com.gs.collections.api.multimap.Multimap
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);
}
});
rejectKeysMultiValues in interface com.gs.collections.api.multimap.bag.BagMultimap<K,V>rejectKeysMultiValues in interface com.gs.collections.api.multimap.bag.MutableBagIterableMultimap<K,V>rejectKeysMultiValues in interface com.gs.collections.api.multimap.Multimap<K,V>rejectKeysMultiValues in interface com.gs.collections.api.multimap.MutableMultimap<K,V>rejectKeysMultiValues in interface com.gs.collections.api.multimap.ordered.OrderedIterableMultimap<K,V>rejectKeysMultiValues in interface com.gs.collections.api.multimap.ordered.ReversibleIterableMultimap<K,V>rejectKeysMultiValues in interface com.gs.collections.api.multimap.ordered.SortedIterableMultimap<K,V>rejectKeysMultiValues in interface com.gs.collections.api.multimap.sortedbag.MutableSortedBagMultimap<K,V>rejectKeysMultiValues in interface com.gs.collections.api.multimap.sortedbag.SortedBagMultimap<K,V>predicate - a Predicate2 to use as the reject criteriaMultimap, which contains elements that don't satisfy the predicatepublic <K2,V2> HashBagMultimap<K2,V2> collectKeysValues(com.gs.collections.api.block.function.Function2<? super K,? super V,com.gs.collections.api.tuple.Pair<K2,V2>> function)
com.gs.collections.api.multimap.Multimap
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());
}
});
collectKeysValues in interface com.gs.collections.api.multimap.bag.MutableBagIterableMultimap<K,V>collectKeysValues in interface com.gs.collections.api.multimap.Multimap<K,V>collectKeysValues in interface com.gs.collections.api.multimap.MutableMultimap<K,V>collectKeysValues in interface com.gs.collections.api.multimap.ordered.OrderedIterableMultimap<K,V>collectKeysValues in interface com.gs.collections.api.multimap.sortedbag.MutableSortedBagMultimap<K,V>collectKeysValues in interface com.gs.collections.api.multimap.sortedbag.SortedBagMultimap<K,V>function - a Function2 to use for transformationMultimap, which contains elements as a result of the transformationpublic <V2> FastListMultimap<K,V2> collectValues(com.gs.collections.api.block.function.Function<? super V,? extends V2> function)
com.gs.collections.api.multimap.Multimap
e.g.
return multimap.collectValues(new Function<Person, String>()
{
public String valueOf(Person person)
{
return person.getLastName();
}
});
collectValues in interface com.gs.collections.api.multimap.bag.MutableBagIterableMultimap<K,V>collectValues in interface com.gs.collections.api.multimap.Multimap<K,V>collectValues in interface com.gs.collections.api.multimap.MutableMultimap<K,V>collectValues in interface com.gs.collections.api.multimap.ordered.OrderedIterableMultimap<K,V>collectValues in interface com.gs.collections.api.multimap.ordered.ReversibleIterableMultimap<K,V>collectValues in interface com.gs.collections.api.multimap.ordered.SortedIterableMultimap<K,V>collectValues in interface com.gs.collections.api.multimap.sortedbag.MutableSortedBagMultimap<K,V>collectValues in interface com.gs.collections.api.multimap.sortedbag.SortedBagMultimap<K,V>function - a Function to use for transformationMultimap, which contains elements as a result of the transformation