Tabnine Logo
HashMap.remove
Code IndexAdd Tabnine to your IDE (free)

How to use
remove
method
in
java.util.HashMap

Best Java code snippets using java.util.HashMap.remove (Showing top 20 results out of 23,805)

Refine searchRefine arrow

  • HashMap.put
  • HashMap.get
  • HashMap.containsKey
  • Iterator.hasNext
  • Iterator.next
  • HashMap.<init>
  • HashMap.keySet
origin: apache/flink

  @Override
  public Double remove(Object key) {
    if (super.containsKey(key)) {
      return super.remove(key);
    } else {
      return 0.0;
    }
  }
};
origin: apache/flink

public void setBroadcastVariable(String name, List<?> value) {
  this.uninitializedBroadcastVars.put(name, value);
  this.initializedBroadcastVars.remove(name);
}
origin: alibaba/jstorm

public synchronized void stop(Flusher flusher, long flushInterval) {
  ArrayList<Flusher> pending = pendingFlushMap.get(flushInterval);
  pending.remove(flusher);
  if (pending.size() == 0) {
    pendingFlushMap.remove(flushInterval);
    timerTaskMap.remove(flushInterval).cancel();
  }
}
origin: apache/flink

final HashMap<String, TaggedValue> resultMapping = new HashMap<String, TaggedValue>(keys.size());
final List<String> filteredMappings = new ArrayList<String>(keys.size());
for (TaggedValue tv : returnValues) {
      else if (!resultMapping.containsKey(key) && !filteredMappings.contains(key)) {
        resultMapping.put(key, cm.get(key));
      else if (resultMapping.containsKey(key)
          && filteredMappings.contains(key)) {
        resultMapping.remove(key);
      else if (resultMapping.containsKey(key)
          && !filteredMappings.contains(key)
          && !cm.get(key).equals(resultMapping.get(key))) {
        filteredMappings.add(key);
        resultMapping.remove(key);
while (it.hasNext()) {
  Map.Entry<String, TaggedValue> entry = it.next();
  TaggedValue value = mergeReturnValues(Collections.singletonList(entry.getValue()));
  if (value == null) {
origin: naman14/Timber

mExtraData = new ArrayList<Object>();
mMapCursorPositions = new HashMap<Long, Integer>(mCursor.getCount());
final int idPosition = mCursor.getColumnIndex(columnName);
    mMapCursorPositions.put(mCursor.getLong(idPosition), mCursor.getPosition());
  } while (mCursor.moveToNext());
    if (mMapCursorPositions.containsKey(id)) {
      mOrderedPositions.add(mMapCursorPositions.get(id));
      mMapCursorPositions.remove(id);
      if (extraData != null) {
        mExtraData.add(extraData.get(i));
origin: ethereum/ethereumj

HashMap<String, String> testerMap = new HashMap<>();
  testerMap.put(word1, word2);
  String word1 = randomWords.get(randomIndex).trim();
  testerMap.remove(word1);
  trie.delete(word1);
Iterator<String> keys = testerMap.keySet().iterator();
while (keys.hasNext()) {
  String mapWord1 = keys.next();
  String mapWord2 = testerMap.get(mapWord1);
  String treeWord2 = new String(trie.get(mapWord1));
origin: apache/storm

public void put(K key, V value) {
  Iterator<HashMap<K, V>> it = _buckets.iterator();
  HashMap<K, V> bucket = it.next();
  bucket.put(key, value);
  while (it.hasNext()) {
    bucket = it.next();
    bucket.remove(key);
  }
}
origin: apache/geode

/**
 * @param nodeToBuckets A map with InternalDistributedSystem as key and either HashSet or
 *        HashMap<Integer, HashSet> as value.
 * @return Map of <old members, set/map of bucket ids they host>.
 */
private HashMap filterOldMembers(HashMap nodeToBuckets) {
 ClusterDistributionManager dm = (ClusterDistributionManager) getDistributionManager();
 HashMap oldGuys = new HashMap();
 Set<InternalDistributedMember> oldMembers =
   new HashSet<InternalDistributedMember>(nodeToBuckets.keySet());
 dm.removeMembersWithSameOrNewerVersion(oldMembers, Version.CURRENT);
 Iterator<InternalDistributedMember> oldies = oldMembers.iterator();
 while (oldies.hasNext()) {
  InternalDistributedMember old = oldies.next();
  if (nodeToBuckets.containsKey(old)) {
   oldGuys.put(old, nodeToBuckets.remove(old));
  } else {
   oldies.remove();
  }
 }
 return oldGuys;
}
origin: org.apache.hadoop/hadoop-common

synchronized ChannelSftp getFromPool(ConnectionInfo info) throws IOException {
 Set<ChannelSftp> cons = idleConnections.get(info);
 ChannelSftp channel;
 if (cons != null && cons.size() > 0) {
  Iterator<ChannelSftp> it = cons.iterator();
  if (it.hasNext()) {
   channel = it.next();
   idleConnections.remove(info);
   return channel;
  } else {
   throw new IOException("Connection pool error.");
  }
 }
 return null;
}
origin: json-iterator/java

public synchronized static void addNewEncoder(String cacheKey, Encoder encoder) {
  HashMap<String, Encoder> newCache = new HashMap<String, Encoder>(encoders);
  if (encoder == null) {
    newCache.remove(cacheKey);
  } else {
    newCache.put(cacheKey, encoder);
  }
  encoders = newCache;
}
origin: Sable/soot

public void clear() {
 Iterator kcit = key_chain.iterator();
 while (kcit.hasNext()) {
  content_map.remove(kcit.next());
 }
 Iterator vcit = value_chain.iterator();
 while (vcit.hasNext()) {
  back_map.remove(vcit.next());
 }
 key_chain.clear();
 value_chain.clear();
}
origin: FudanNLP/fnlp

private void mapKey(int orikey, int key) throws Exception {
  int orivalue = map.get(orikey);
  int value = map.get(key);
  ArrayList<Integer> oriKeyList = mapList.get(orivalue);
  ArrayList<Integer> keyList = mapList.get(value);
  for (Integer temp : oriKeyList) {
    map.put(temp, value);
    keyList.add(temp);
  }
  mapList.remove(orivalue);
}

origin: spotbugs/spotbugs

public void test3Bugs(HashMap<? extends CharSequence, ? extends CharSequence> map) {
  map.containsValue(3);
  map.containsKey(4.0);
  map.get(5.0);
  map.remove('r');
}
origin: com.h2database/h2

/**
 * Get the web session object for the given session id.
 *
 * @param sessionId the session id
 * @return the web session or null
 */
WebSession getSession(String sessionId) {
  long now = System.currentTimeMillis();
  if (lastTimeoutCheck + SESSION_TIMEOUT < now) {
    for (String id : new ArrayList<>(sessions.keySet())) {
      WebSession session = sessions.get(id);
      if (session.lastAccess + SESSION_TIMEOUT < now) {
        trace("timeout for " + id);
        sessions.remove(id);
      }
    }
    lastTimeoutCheck = now;
  }
  WebSession session = sessions.get(sessionId);
  if (session != null) {
    session.lastAccess = System.currentTimeMillis();
  }
  return session;
}
origin: internetarchive/heritrix3

for(String jobName: jobConfigs.keySet().toArray(new String[0])) {
  CrawlJob cj = jobConfigs.get(jobName);
  if(!cj.getJobDir().exists()) {
    jobConfigs.remove(jobName); 
  if (jobConfigs.containsKey(jobFile.getName())) {
    continue;
origin: com.h2database/h2

/**
 * Rename a database object.
 *
 * @param session the session
 * @param obj the object
 * @param newName the new name
 */
public synchronized void renameDatabaseObject(Session session,
    DbObject obj, String newName) {
  checkWritingAllowed();
  int type = obj.getType();
  HashMap<String, DbObject> map = getMap(type);
  if (SysProperties.CHECK) {
    if (!map.containsKey(obj.getName())) {
      DbException.throwInternalError("not found: " + obj.getName());
    }
    if (obj.getName().equals(newName) || map.containsKey(newName)) {
      DbException.throwInternalError("object already exists: " + newName);
    }
  }
  obj.checkRename();
  int id = obj.getId();
  lockMeta(session);
  removeMeta(session, id);
  map.remove(obj.getName());
  obj.rename(newName);
  map.put(newName, obj);
  updateMetaAndFirstLevelChildren(session, obj);
}
origin: jMonkeyEngine/jmonkeyengine

private void updateRigidBodies() {
  HashMap<PhysicsRigidBody, Spatial> oldObjects = bodies;
  bodies = new HashMap<PhysicsRigidBody, Spatial>();
  Collection<PhysicsRigidBody> current = space.getRigidBodyList();
  //create new map
  for (Iterator<PhysicsRigidBody> it = current.iterator(); it.hasNext();) {
    PhysicsRigidBody physicsObject = it.next();
    //copy existing spatials
    if (oldObjects.containsKey(physicsObject)) {
      Spatial spat = oldObjects.get(physicsObject);
      bodies.put(physicsObject, spat);
      oldObjects.remove(physicsObject);
    } else {
      if (filter == null || filter.displayObject(physicsObject)) {
        logger.log(Level.FINE, "Create new debug RigidBody");
        //create new spatial
        Node node = new Node(physicsObject.toString());
        node.addControl(new BulletRigidBodyDebugControl(this, physicsObject));
        bodies.put(physicsObject, node);
        physicsDebugRootNode.attachChild(node);
      }
    }
  }
  //remove leftover spatials
  for (Map.Entry<PhysicsRigidBody, Spatial> entry : oldObjects.entrySet()) {
    PhysicsRigidBody object = entry.getKey();
    Spatial spatial = entry.getValue();
    spatial.removeFromParent();
  }
}
origin: aa112901/remusic

mExtraData = new ArrayList<Object>();
mMapCursorPositions = new HashMap<Long, Integer>(mCursor.getCount());
final int idPosition = mCursor.getColumnIndex(columnName);
    mMapCursorPositions.put(mCursor.getLong(idPosition), mCursor.getPosition());
  } while (mCursor.moveToNext());
    if (mMapCursorPositions.containsKey(id)) {
      mOrderedPositions.add(mMapCursorPositions.get(id));
      mMapCursorPositions.remove(id);
      if (extraData != null) {
        mExtraData.add(extraData.get(i));
origin: apache/geode

Set<Integer> bucketSet = new HashSet<Integer>();
Iterator<Integer> itr = this.getRegionAdvisor().getBucketSet().iterator();
while (itr.hasNext()) {
 try {
  bucketSet.add(itr.next());
 } catch (NoSuchElementException ignore) {
 Set memberKeySet = memberToBuckets.keySet();
 RetryTimeKeeper retryTime = new RetryTimeKeeper(this.retryTimeout);
 while (iterator.hasNext()) {
  if (execution.getFailedNodes().contains(((DistributedMember) iterator.next()).getId())) {
   hasRemovedNode = true;
Set<InternalDistributedMember> dest = memberToBuckets.keySet();
execution.validateExecution(function, dest);
execution.setExecutionNodes(dest);
final Set<Integer> localBucketSet = memberToBuckets.remove(getMyId());
if (localBucketSet != null) {
 isSelf = true;
  new HashMap<InternalDistributedMember, FunctionRemoteContext>();
for (InternalDistributedMember recip : memberToBuckets.keySet()) {
 FunctionRemoteContext context = new FunctionRemoteContext(function,
   execution.getArgumentsForMember(recip.getId()), null, memberToBuckets.get(recip),
   execution.isReExecute(), execution.isFnSerializationReqd());
 recipMap.put(recip, context);
origin: alibaba/jstorm

@Override
public void put(K key, V value) {
  synchronized (lock) {
    Iterator<HashMap<K, V>> it = buckets.iterator();
    HashMap<K, V> bucket = it.next();
    bucket.put(key, value);
    while (it.hasNext()) {
      bucket = it.next();
      bucket.remove(key);
    }
  }
}
java.utilHashMapremove

Javadoc

Removes the mapping with the specified key from this map.

Popular methods of HashMap

  • <init>
    Constructs a new HashMap instance containing the mappings from the specified map.
  • put
    Maps the specified key to the specified value.
  • get
    Returns the value of the mapping with the specified key.
  • containsKey
    Returns whether this map contains the specified key.
  • keySet
    Returns a set of the keys contained in this map. The set is backed by this map so changes to one are
  • entrySet
    Returns a set containing all of the mappings in this map. Each mapping is an instance of Map.Entry.
  • values
    Returns a collection of the values contained in this map. The collection is backed by this map so ch
  • size
    Returns the number of elements in this map.
  • clear
    Removes all mappings from this hash map, leaving it empty.
  • isEmpty
    Returns whether this map is empty.
  • putAll
    Copies all the mappings in the specified map to this map. These mappings will replace all mappings t
  • clone
    Returns a shallow copy of this map.
  • putAll,
  • clone,
  • toString,
  • containsValue,
  • equals,
  • hashCode,
  • computeIfAbsent,
  • getOrDefault,
  • forEach

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setRequestProperty (URLConnection)
  • getResourceAsStream (ClassLoader)
  • putExtra (Intent)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • From CI to AI: The AI layer in your organization
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