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

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

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

origin: goldmansachs/gs-collections

@Benchmark
public void serial_lazy_jdk()
{
  Map<Alphagram, List<String>> groupBy = this.guavaWords.stream().collect(Collectors.groupingBy(Alphagram::new));
  groupBy.entrySet()
      .stream()
      .map(Map.Entry::getValue)
      .filter(list -> list.size() >= SIZE_THRESHOLD)
      .sorted(Comparator.<List<String>>comparingInt(List::size).reversed())
      .map(list -> list.size() + ": " + list)
      .forEach(e -> Assert.assertFalse(e.isEmpty()));
}
origin: batfish/batfish

/**
 * Given a filter and a set of rows, returns the subset of rows that match the filter
 *
 * @param filter The filter that should be matched
 * @param inputRows The input set of rows
 * @return A new set with matching rows
 */
@VisibleForTesting
static Multiset<Row> filterRows(Filter filter, Multiset<Row> inputRows) {
 return inputRows.stream()
   .filter(filter::matches)
   .collect(ImmutableMultiset.toImmutableMultiset());
}
origin: kframework/k

@Override
public void visit(BuiltinSet builtinSet) {
  builtinSet.elements().stream().forEach(this::visitNode);
  builtinSet.baseTerms().stream().forEach(this::visitNode);
  visit((Collection) builtinSet);
}
origin: OpenGamma/Strata

@Override
public Set<String> tokens(Iterable<?> iterable) {
 Multiset<String> tokens = HashMultiset.create();
 int index = 0;
 for (Object item : iterable) {
  tokens.add(String.valueOf(index++));
  tokens.addAll(fieldValues(item));
 }
 return tokens.stream()
   .filter(token -> tokens.count(token) == 1)
   .collect(toImmutableSet());
}
origin: kframework/k

@Override
public void visit(BuiltinMap builtinMap) {
  builtinMap.getEntries().entrySet().stream().forEach(e -> {
    visitNode(e.getKey());
    visitNode(e.getValue());
  });
  builtinMap.baseTerms().stream().forEach(this::visitNode);
  visit((Collection) builtinMap);
}
origin: batfish/batfish

 /**
  * Selects specified columns from the Multiset of rows that is provided as input. A new set is
  * created and returned, and the input is not modified.
  *
  * @param columns The columns to select
  * @param inputRows The input set.
  * @returns A new set of rows with specified columns
  */
 @VisibleForTesting
 static Multiset<Row> selectColumns(Set<String> columns, Multiset<Row> inputRows) {
  return inputRows.stream()
    .map(row -> Row.builder().putAll(row, columns).build())
    .collect(ImmutableMultiset.toImmutableMultiset());
 }
}
origin: protegeproject/webprotege

  @Override
  public boolean matches(@Nonnull OWLEntity entity) {
    // Count languages by property
    Map<OWLAnnotationProperty, Multiset<String>> prop2Langs = new HashMap<>();
    axiomsIndex.getAnnotationAssertionAxioms(entity.getIRI())
          .filter(ax -> propertyMatcher.matches(ax.getProperty()))
          .filter(ax -> ax.getValue() instanceof OWLLiteral)
          .forEach(ax -> {
                    Multiset<String> langs = prop2Langs.computeIfAbsent(ax.getProperty(), p -> HashMultiset.create());
                    String lang = ((OWLLiteral) ax.getValue()).getLang();
                    langs.add(lang);
                  });
    return prop2Langs.values().stream()
             .anyMatch(langsForProp -> langsForProp.stream().anyMatch(lang -> langsForProp.count(lang) > 1));
  }
}
origin: batfish/batfish

return table.getRows().getData().stream()
  .map(rowToInteger)
  .filter(Objects::nonNull)
origin: batfish/batfish

@Override
public AnswerElement answer() {
 IpsecSessionStatusQuestion question = (IpsecSessionStatusQuestion) _question;
 Map<String, Configuration> configurations = _batfish.loadConfigurations();
 NetworkConfigurations networkConfigurations = NetworkConfigurations.of(configurations);
 ValueGraph<IpsecPeerConfigId, IpsecSession> ipsecTopology =
   IpsecUtil.initIpsecTopology(configurations);
 Set<String> initiatorNodes = question.getInitiatorRegex().getMatchingNodes(_batfish);
 Set<String> responderNodes = question.getResponderRegex().getMatchingNodes(_batfish);
 TableAnswerElement answerElement = new TableAnswerElement(createTableMetaData(question));
 Multiset<IpsecSessionInfo> ipsecSessionInfos =
   rawAnswer(networkConfigurations, ipsecTopology, initiatorNodes, responderNodes);
 answerElement.postProcessAnswer(
   question,
   ipsecSessionInfos.stream()
     .filter(
       ipsecSessionInfo ->
         question.matchesStatus(ipsecSessionInfo.getIpsecSessionStatus()))
     .map(IpsecSessionStatusAnswerer::toRow)
     .collect(Collectors.toCollection(HashMultiset::create)));
 return answerElement;
}
com.google.common.collectMultisetstream

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,
  • forEachEntry,
  • retainAll

Popular in Java

  • Making http post requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • findViewById (Activity)
  • getResourceAsStream (ClassLoader)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • ImageIO (javax.imageio)
  • Top plugins for WebStorm
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