Tabnine Logo
Multiset.retainAll
Code IndexAdd Tabnine to your IDE (free)

How to use
retainAll
method
in
com.google.common.collect.Multiset

Best Java code snippets using com.google.common.collect.Multiset.retainAll (Showing top 6 results out of 315)

origin: google/guava

@CollectionSize.Require(SEVERAL)
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testRetainAllIgnoresCount() {
 initThreeCopies();
 List<E> contents = Helpers.copyToList(getMultiset());
 assertFalse(getMultiset().retainAll(Collections.singleton(e0())));
 expectContents(contents);
}
origin: aadnk/ProtocolLib

@Override
public boolean retainAll(Collection<?> arg0) {
  return multiset.retainAll(arg0);
}
origin: com.google.guava/guava-testlib-jdk5

@CollectionSize.Require(SEVERAL)
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testRetainAllIgnoresCount() {
 initThreeCopies();
 List<E> contents = Helpers.copyToList(getMultiset());
 assertFalse(getMultiset().retainAll(Collections.singleton(samples.e0)));
 expectContents(contents);
}

origin: org.eclipse.xtext/org.eclipse.xtext.xbase

/**
 * Keeps the cumulated distance for all the common raw super types of the given references.
 * Interfaces that are more directly implemented will get a lower total count than more general
 * interfaces.
 */
protected void cumulateDistance(final List<LightweightTypeReference> references, Multimap<JvmType, LightweightTypeReference> all,
    Multiset<JvmType> cumulatedDistance) {
  for(LightweightTypeReference other: references) {
    Multiset<JvmType> otherDistance = LinkedHashMultiset.create();
    initializeDistance(other, all, otherDistance);
    cumulatedDistance.retainAll(otherDistance);
    for(Multiset.Entry<JvmType> typeToDistance: otherDistance.entrySet()) {
      if (cumulatedDistance.contains(typeToDistance.getElement()))
        cumulatedDistance.add(typeToDistance.getElement(), typeToDistance.getCount());
    }
  }
}
origin: org.eclipse.xtext.common/types

/**
 * Keeps the cumulated distance for all the common raw super types of the given references.
 * Interfaces that are more directly implemented will get a lower total count than more general
 * interfaces.
 */
protected void cumulateDistance(final List<JvmTypeReference> references, Multimap<JvmType, JvmTypeReference> all,
    Multiset<JvmType> cumulatedDistance) {
  for(JvmTypeReference other: references) {
    Multiset<JvmType> otherDistance = LinkedHashMultiset.create();
    initializeDistance(other, all, otherDistance);
    cumulatedDistance.retainAll(otherDistance);
    for(Multiset.Entry<JvmType> typeToDistance: otherDistance.entrySet()) {
      if (cumulatedDistance.contains(typeToDistance.getElement()))
        cumulatedDistance.add(typeToDistance.getElement(), typeToDistance.getCount());
    }
  }
}
origin: com.google.guava/guava-testlib

@CollectionSize.Require(SEVERAL)
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testRetainAllIgnoresCount() {
 initThreeCopies();
 List<E> contents = Helpers.copyToList(getMultiset());
 assertFalse(getMultiset().retainAll(Collections.singleton(e0())));
 expectContents(contents);
}
com.google.common.collectMultisetretainAll

Javadoc

Note: This method ignores how often any element might appear in c, and only cares whether or not an element appears at all. If you wish to remove one occurrence in this multiset for every occurrence in c, see Multisets#retainOccurrences(Multiset,Multiset).

This method refines Collection#retainAll to further specify that it may not throw an exception in response to any of elementsbeing null or of the wrong type.

Popular methods of Multiset

  • add
    Adds a number of occurrences of an element to this multiset. Note that if occurrences == 1, this met
  • count
    Returns the number of occurrences of an element in this multiset (thecount of the element). Note tha
  • elementSet
    Returns the set of distinct elements contained in this multiset. The element set is backed by the sa
  • entrySet
    Returns a view of the contents of this multiset, grouped into Multiset.Entry instances, each providi
  • remove
    Removes a number of occurrences of the specified element from this multiset. If the multiset contain
  • size
    Returns the total number of all occurrences of all elements in this multiset. Note: this method does
  • isEmpty
  • clear
  • contains
    Determines whether this multiset contains the specified element.This method refines Collection#conta
  • addAll
  • setCount
    Conditionally sets the count of an element to a new value, as described in #setCount(Object,int), pr
  • iterator
    Elements that occur multiple times in the multiset will appear multiple times in this iterator, thou
  • setCount,
  • iterator,
  • equals,
  • containsAll,
  • hashCode,
  • removeAll,
  • toString,
  • stream,
  • forEachEntry

Popular in Java

  • Running tasks concurrently on multiple threads
  • onRequestPermissionsResult (Fragment)
  • compareTo (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now