Interface BagMultimap<K,​V>

All Superinterfaces:
Multimap<K,​V>
All Known Subinterfaces:
ImmutableBagIterableMultimap<K,​V>, ImmutableBagMultimap<K,​V>, ImmutableSortedBagMultimap<K,​V>, MutableBagIterableMultimap<K,​V>, MutableBagMultimap<K,​V>, MutableSortedBagMultimap<K,​V>, SortedBagMultimap<K,​V>, UnsortedBagMultimap<K,​V>
All Known Implementing Classes:
AbstractMutableBagMultimap, HashBagMultimap, HashBagMultimapWithHashingStrategy, ImmutableBagMultimapImpl, ImmutableSortedBagMultimapImpl, MultiReaderHashBagMultimap, SynchronizedBagMultimap, SynchronizedPutHashBagMultimap, SynchronizedSortedBagMultimap, TreeBagMultimap, TreeBagMultimap, TreeBagMultimap

public interface BagMultimap<K,​V>
extends Multimap<K,​V>
  • Method Details

    • newEmpty

      BagMultimap<K,​V> newEmpty()
      Description copied from interface: Multimap
      Creates a new instance of the same implementation type, using the default capacity and growth parameters.
      Specified by:
      newEmpty in interface Multimap<K,​V>
    • get

      Bag<V> get​(K key)
      Description copied from interface: Multimap
      Returns a view of all values associated with the given key.

      If the given key does not exist, an empty RichIterable is returned.

      Specified by:
      get in interface Multimap<K,​V>
      Parameters:
      key - the key to search for
    • flip

      BagMultimap<V,​K> flip()
      Description copied from interface: Multimap
      Given a Multimap from Domain -> Range return a multimap from Range -> Domain.
      Specified by:
      flip in interface Multimap<K,​V>
    • selectKeysValues

      BagMultimap<K,​V> selectKeysValues​(Predicate2<? super K,​? super V> predicate)
      Description copied from interface: Multimap
      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"));
           }
       });
       
      Specified by:
      selectKeysValues in interface Multimap<K,​V>
      Parameters:
      predicate - a Predicate2 to use as the select criteria
      Returns:
      Multimap, which contains elements as a result of the select criteria
    • rejectKeysValues

      BagMultimap<K,​V> rejectKeysValues​(Predicate2<? super K,​? super V> predicate)
      Description copied from interface: Multimap
      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"));
           }
       });
       
      Specified by:
      rejectKeysValues in interface Multimap<K,​V>
      Parameters:
      predicate - a Predicate2 to use as the reject criteria
      Returns:
      Multimap, which contains elements that don't satisfy the predicate
    • selectKeysMultiValues

      BagMultimap<K,​V> selectKeysMultiValues​(Predicate2<? super K,​? super Iterable<V>> predicate)
      Description copied from interface: Multimap
      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);
           }
       });
       
      Specified by:
      selectKeysMultiValues in interface Multimap<K,​V>
      Parameters:
      predicate - a Predicate2 to use as the select criteria
      Returns:
      Multimap, which contains elements as a result of the select criteria
    • rejectKeysMultiValues

      BagMultimap<K,​V> rejectKeysMultiValues​(Predicate2<? super K,​? super Iterable<V>> predicate)
      Description copied from interface: Multimap
      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);
           }
       });
       
      Specified by:
      rejectKeysMultiValues in interface Multimap<K,​V>
      Parameters:
      predicate - a Predicate2 to use as the reject criteria
      Returns:
      Multimap, which contains elements that don't satisfy the predicate