Tabnine Logo
SortedSetMultimap.put
Code IndexAdd Tabnine to your IDE (free)

How to use
put
method
in
com.google.common.collect.SortedSetMultimap

Best Java code snippets using com.google.common.collect.SortedSetMultimap.put (Showing top 20 results out of 315)

origin: Graylog2/graylog2-server

private void updateCache(Stream stream) {
  LOG.debug("Updating stream id/title cache for {}/'{}'", stream.getId(), stream.getTitle());
  idToStream.put(stream.getId(), stream);
  nameToStream.put(stream.getTitle(), stream);
}
origin: MovingBlocks/Terasology

  sortedApi.put(category, apiPackage + " (PACKAGE)");
} else {
  sortedApi.put(category, apiClass.getName() + (apiClass.isInterface() ? " (INTERFACE)" : " (CLASS)"));
  sortedApi.put(category, apiPackage + " (PACKAGE)");
} else {
  sortedApi.put(category, apiClass.getName() + (apiClass.isInterface() ? " (INTERFACE)" : " (CLASS)"));
origin: MovingBlocks/Terasology

@ReceiveEvent
public void delayedComponentActivated(OnActivatedComponent event, EntityRef entity, DelayedActionComponent delayedActionComponent) {
  delayedOperationsSortedByTime.put(delayedActionComponent.getLowestWakeUp(), entity);
}
origin: MovingBlocks/Terasology

@ReceiveEvent
public void periodicComponentActivated(OnActivatedComponent event, EntityRef entity, PeriodicActionComponent periodicActionComponent) {
  periodicOperationsSortedByTime.put(periodicActionComponent.getLowestWakeUp(), entity);
}
origin: apache/hive

@Override public Void visitFieldAccess(RexFieldAccess fieldAccess) {
 final RexNode ref = fieldAccess.getReferenceExpr();
 if (ref instanceof RexCorrelVariable) {
  final RexCorrelVariable var = (RexCorrelVariable) ref;
  if (mapFieldAccessToCorVar.containsKey(fieldAccess)) {
   //for cases where different Rel nodes are referring to
   // same correlation var (e.g. in case of NOT IN)
   // avoid generating another correlation var
   // and record the 'rel' is using the same correlation
   mapRefRelToCorRef.put(rel,
     mapFieldAccessToCorVar.get(fieldAccess));
  } else {
   final CorRef correlation =
     new CorRef(var.id, fieldAccess.getField().getIndex(),
       corrIdGenerator++);
   mapFieldAccessToCorVar.put(fieldAccess, correlation);
   mapRefRelToCorRef.put(rel, correlation);
  }
 }
 return super.visitFieldAccess(fieldAccess);
}
origin: google/guava

/** Test that creating one TreeMultimap from a SortedSetMultimap uses natural ordering. */
public void testCreateFromSortedSetMultimap() {
 SortedSetMultimap<Double, Double> tree = TreeMultimap.create(KEY_COMPARATOR, VALUE_COMPARATOR);
 tree.put(1.0, 2.0);
 tree.put(2.0, 3.0);
 tree.put(3.0, 4.0);
 tree.put(4.0, 5.0);
 SortedSetMultimap<Double, Double> sorted = Multimaps.unmodifiableSortedSetMultimap(tree);
 TreeMultimap<Double, Double> copyFromSorted = TreeMultimap.create(sorted);
 assertEquals(tree, copyFromSorted);
 assertSame(Ordering.natural(), copyFromSorted.keyComparator());
 assertSame(Ordering.natural(), copyFromSorted.valueComparator());
 assertSame(Ordering.natural(), copyFromSorted.get(1.0).comparator());
}
origin: google/error-prone

    Comparator.comparing(MiniDescription::name));
for (BugPatternInstance pattern : patterns) {
 sorted.put(
   IndexEntry.create(enabledChecks.contains(pattern.name), pattern.severity),
   MiniDescription.create(pattern));
origin: MovingBlocks/Terasology

private void invokeDelayedOperations(long currentWorldTime) {
  List<EntityRef> operationsToInvoke = new LinkedList<>();
  Iterator<Long> scheduledOperationsIterator = delayedOperationsSortedByTime.keySet().iterator();
  long processedTime;
  while (scheduledOperationsIterator.hasNext()) {
    processedTime = scheduledOperationsIterator.next();
    if (processedTime > currentWorldTime) {
      break;
    }
    operationsToInvoke.addAll(delayedOperationsSortedByTime.get(processedTime));
    scheduledOperationsIterator.remove();
  }
  operationsToInvoke.stream().filter(EntityRef::exists).forEach(delayedEntity -> {
    final DelayedActionComponent delayedActions = delayedEntity.getComponent(DelayedActionComponent.class);
    // If there is a DelayedActionComponent, proceed. Else report an error to the log.
    if (delayedActions != null) {
      final Set<String> actionIds = delayedActions.removeActionsUpTo(currentWorldTime);
      saveOrRemoveComponent(delayedEntity, delayedActions);
      if (!delayedActions.isEmpty()) {
        delayedOperationsSortedByTime.put(delayedActions.getLowestWakeUp(), delayedEntity);
      }
      for (String actionId : actionIds) {
        delayedEntity.send(new DelayedActionTriggeredEvent(actionId));
      }
    } else {
      logger.error("ERROR: This entity is missing a DelayedActionComponent: {}. " +
          "So skipping delayed actions for this entity.", delayedEntity);
    }
  });
}
origin: MovingBlocks/Terasology

private void invokePeriodicOperations(long currentWorldTime) {
  List<EntityRef> operationsToInvoke = new LinkedList<>();
  Iterator<Long> scheduledOperationsIterator = periodicOperationsSortedByTime.keySet().iterator();
  long processedTime;
  while (scheduledOperationsIterator.hasNext()) {
    processedTime = scheduledOperationsIterator.next();
    if (processedTime > currentWorldTime) {
      break;
    }
    operationsToInvoke.addAll(periodicOperationsSortedByTime.get(processedTime));
    scheduledOperationsIterator.remove();
  }
  operationsToInvoke.stream().filter(EntityRef::exists).forEach(periodicEntity -> {
    final PeriodicActionComponent periodicActionComponent = periodicEntity.getComponent(PeriodicActionComponent.class);
    // If there is a PeriodicActionComponent, proceed. Else report an error to the log.
    if (periodicActionComponent != null) {
      final Set<String> actionIds = periodicActionComponent.getTriggeredActionsAndReschedule(currentWorldTime);
      saveOrRemoveComponent(periodicEntity, periodicActionComponent);
      if (!periodicActionComponent.isEmpty()) {
        periodicOperationsSortedByTime.put(periodicActionComponent.getLowestWakeUp(), periodicEntity);
      }
      for (String actionId : actionIds) {
        periodicEntity.send(new PeriodicActionTriggeredEvent(actionId));
      }
    } else {
      logger.error("ERROR: This entity is missing a DelayedActionComponent: {}. " +
          "So skipping delayed actions for this entity", periodicEntity);
    }
  });
}
origin: MovingBlocks/Terasology

@Override
public void addPeriodicAction(EntityRef entity, String actionId, long initialDelay, long period) {
  long scheduleTime = time.getGameTimeInMs() + initialDelay;
  PeriodicActionComponent periodicActionComponent = entity.getComponent(PeriodicActionComponent.class);
  if (periodicActionComponent != null) {
    final long oldWakeUp = periodicActionComponent.getLowestWakeUp();
    periodicActionComponent.addScheduledActionId(actionId, scheduleTime, period);
    entity.saveComponent(periodicActionComponent);
    final long newWakeUp = periodicActionComponent.getLowestWakeUp();
    if (oldWakeUp < newWakeUp) {
      periodicOperationsSortedByTime.remove(oldWakeUp, entity);
      periodicOperationsSortedByTime.put(newWakeUp, entity);
    } else {
      // Even if the oldWakeUp time is greater than or equal to the new one, the next action should still be added
      // to the delayedOperationsSortedByTime mapping.
      periodicOperationsSortedByTime.put(scheduleTime, entity);
    }
  } else {
    periodicActionComponent = new PeriodicActionComponent();
    periodicActionComponent.addScheduledActionId(actionId, scheduleTime, period);
    entity.addComponent(periodicActionComponent);
  }
}
origin: MovingBlocks/Terasology

@Override
public void addDelayedAction(EntityRef entity, String actionId, long delay) {
  long scheduleTime = time.getGameTimeInMs() + delay;
  DelayedActionComponent delayedActionComponent = entity.getComponent(DelayedActionComponent.class);
  if (delayedActionComponent != null) {
    final long oldWakeUp = delayedActionComponent.getLowestWakeUp();
    delayedActionComponent.addActionId(actionId, scheduleTime);
    entity.saveComponent(delayedActionComponent);
    final long newWakeUp = delayedActionComponent.getLowestWakeUp();
    if (oldWakeUp < newWakeUp) {
      delayedOperationsSortedByTime.remove(oldWakeUp, entity);
      delayedOperationsSortedByTime.put(newWakeUp, entity);
    } else {
      // Even if the oldWakeUp time is greater than or equal to the new one, the next action should still be added
      // to the delayedOperationsSortedByTime mapping.
      delayedOperationsSortedByTime.put(scheduleTime, entity);
    }
  } else {
    delayedActionComponent = new DelayedActionComponent();
    delayedActionComponent.addActionId(actionId, scheduleTime);
    entity.addComponent(delayedActionComponent);
  }
}
origin: MovingBlocks/Terasology

@Override
public void cancelPeriodicAction(EntityRef entity, String actionId) {
  PeriodicActionComponent periodicActionComponent = entity.getComponent(PeriodicActionComponent.class);
  long oldWakeUp = periodicActionComponent.getLowestWakeUp();
  periodicActionComponent.removeScheduledActionId(actionId);
  long newWakeUp = periodicActionComponent.getLowestWakeUp();
  if (!periodicActionComponent.isEmpty() && oldWakeUp < newWakeUp) {
    periodicOperationsSortedByTime.remove(oldWakeUp, entity);
    periodicOperationsSortedByTime.put(newWakeUp, entity);
  } else if (periodicActionComponent.isEmpty()) {
    periodicOperationsSortedByTime.remove(oldWakeUp, entity);
  }
  saveOrRemoveComponent(entity, periodicActionComponent);
}
origin: MovingBlocks/Terasology

@Override
public void cancelDelayedAction(EntityRef entity, String actionId) {
  DelayedActionComponent delayedComponent = entity.getComponent(DelayedActionComponent.class);
  long oldWakeUp = delayedComponent.getLowestWakeUp();
  delayedComponent.removeActionId(actionId);
  long newWakeUp = delayedComponent.getLowestWakeUp();
  if (!delayedComponent.isEmpty() && oldWakeUp < newWakeUp) {
    delayedOperationsSortedByTime.remove(oldWakeUp, entity);
    delayedOperationsSortedByTime.put(newWakeUp, entity);
  } else if (delayedComponent.isEmpty()) {
    delayedOperationsSortedByTime.remove(oldWakeUp, entity);
  }
  saveOrRemoveComponent(entity, delayedComponent);
}
origin: gaul/s3proxy

canonicalizedHeaders.put(headerName, "");
canonicalizedHeaders.put(headerName,
    Strings.nullToEmpty(headerValue));
origin: palantir/atlasdb

private static SortedSetMultimap<Integer, byte[]> getRowsForBatches(
    Supplier<SqlConnection> connectionSupplier,
    String query,
    Object[] args) {
  SqlConnection connection = connectionSupplier.get();
  try {
    AgnosticResultSet results = connection.selectResultSetUnregisteredQuery(query, args);
    SortedSetMultimap<Integer, byte[]> ret = TreeMultimap.create(
        Ordering.natural(),
        UnsignedBytes.lexicographicalComparator());
    for (AgnosticResultRow row : results.rows()) {
      @SuppressWarnings("deprecation")
      byte[] rowName = row.getBytes("row_name");
      int batchNum = row.getInteger("batch_num");
      if (rowName != null) {
        ret.put(batchNum, rowName);
      }
    }
    return ret;
  } finally {
    closeSql(connection);
  }
}
origin: linkedin/indextank-engine

private void internalAdd(int idx, final Document document) {
  for (String field : document.getFieldNames()) {
    Iterator<AToken> tokens = parser.parseDocumentField(field, document.getField(field));
    SortedSetMultimap<String, Integer> termPositions = TreeMultimap.create();
    int tokenCount = 0;
    while (tokens.hasNext()) {
      tokenCount++;
      AToken token = tokens.next();
      termPositions.put(token.getText(), token.getPosition());
    }
      
    for (String term : termPositions.keySet()) {
      Key key = new Key(field, term);
      SortedSet<Integer> positionsSet = termPositions.get(term);
      int[] positions = new int[positionsSet.size()];
      int p = 0;
      for (Integer i : positionsSet) {
        positions[p++] = i;
      }
      DocTermMatchList original = invertedIndex.putIfAbsent(key, new DocTermMatchList(idx, positions, tokenCount));
      if (original != null) {
        original.add(idx, positions, tokenCount);
      }
    }
  }
}
origin: org.apache.apex/malhar-library

@Override
public void put(Window window, K key, V value)
{
 @SuppressWarnings("unchecked")
 Window.SessionWindow<K> sessionWindow = (Window.SessionWindow<K>)window;
 super.put(window, key, value);
 keyToWindows.put(key, sessionWindow);
}
origin: jclouds/legacy-jclouds

@VisibleForTesting
void appendHttpHeaders(HttpRequest request, SortedSetMultimap<String, String> canonicalizedHeaders) {
 Multimap<String, String> headers = request.getHeaders();
 for (Entry<String, String> header : headers.entries()) {
   if (header.getKey() == null)
    continue;
   String key = header.getKey().toString().toLowerCase(Locale.getDefault());
   // Ignore any headers that are not particularly interesting.
   if (key.equalsIgnoreCase(HttpHeaders.CONTENT_TYPE) || key.equalsIgnoreCase("Content-MD5")
       || key.equalsIgnoreCase(HttpHeaders.DATE) || key.startsWith("x-" + headerTag + "-")) {
    canonicalizedHeaders.put(key, header.getValue());
   }
 }
}
origin: org.jabylon/updatecenter

private Multimap<String, Bundle> buildMap(List<Bundle> bundles) {
  SortedSetMultimap<String, Bundle> result = TreeMultimap.create(Collator.getInstance(), new BundleVersionComparator());
  for (Bundle bundle : bundles) {
    result.put(bundle.getSymbolicName(), bundle);
  }
  return result;
}
origin: org.apache.apex/malhar-library

@Override
public void migrateWindow(Window.SessionWindow<K> fromWindow, Window.SessionWindow<K> toWindow)
{
 if (!containsWindow(fromWindow)) {
  throw new NoSuchElementException();
 }
 map.put(toWindow, map.remove(fromWindow));
 keyToWindows.remove(fromWindow.getKey(), fromWindow);
 keyToWindows.put(toWindow.getKey(), toWindow);
}
com.google.common.collectSortedSetMultimapput

Popular methods of SortedSetMultimap

  • get
    Returns a collection view of all values associated with a key. If no mappings in the multimap have t
  • removeAll
    Removes all values associated with a given key.Because a SortedSetMultimap has unique sorted values
  • valueComparator
    Returns the comparator that orders the multimap values, with nullindicating that natural ordering is
  • replaceValues
    Stores a collection of values with the same key, replacing any existing values for that key.Because
  • asMap
    Returns a map view that associates each key with the corresponding values in the multimap. Changes t
  • keySet
  • putAll
  • entries
  • values
  • containsKey
  • remove
  • size
  • remove,
  • size,
  • isEmpty,
  • clear

Popular in Java

  • Updating database using SQL prepared statement
  • startActivity (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • scheduleAtFixedRate (Timer)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Collectors (java.util.stream)
  • JTable (javax.swing)
  • Github Copilot alternatives
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