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

How to use
clear
method
in
java.util.HashMap

Best Java code snippets using java.util.HashMap.clear (Showing top 20 results out of 17,559)

Refine searchRefine arrow

  • HashMap.put
  • HashMap.entrySet
  • Map.Entry.getValue
  • HashMap.get
  • Map.Entry.getKey
origin: com.h2database/h2

/**
 * Set the source code for the specified class.
 * This will reset all compiled classes.
 *
 * @param className the class name
 * @param source the source code
 */
public void setSource(String className, String source) {
  sources.put(className, source);
  compiled.clear();
}
origin: FudanNLP/fnlp

private void filter(int i) {
  HashMap<String, Integer> newwordsFreq = new HashMap<String, Integer>();
  for(Entry<String, Integer> e : wordsFreq.entrySet()){
    
    Integer v = e.getValue();
    if(v>i){
      String key = e.getKey();
      newwordsFreq.put(key, v);
    }
  }
  wordsFreq.clear();
  wordsFreq = newwordsFreq;
}
origin: commons-collections/commons-collections

/**
 * Clear the map.
 * <p>
 * This clears each collection in the map, and so may be slow.
 */
public void clear() {
  // For gc, clear each list in the map
  Set pairs = super.entrySet();
  Iterator pairsIterator = pairs.iterator();
  while (pairsIterator.hasNext()) {
    Map.Entry keyValuePair = (Map.Entry) pairsIterator.next();
    Collection coll = (Collection) keyValuePair.getValue();
    coll.clear();
  }
  super.clear();
}
origin: looly/hutool

super.clear();
BufferedReader reader = null;
try {
      valueSet = super.get(group);
      if (null == valueSet) {
        valueSet = new LinkedHashSet<String>();
      super.put(group, valueSet);
      continue;
      super.put(StrUtil.EMPTY, valueSet);
origin: Sable/soot

protected void flowThrough(HashMap<Local, Set<NewExpr>> in, Unit unit, HashMap<Local, Set<NewExpr>> out) {
 Stmt s = (Stmt) unit;
 out.clear();
 out.putAll(in);
 if (s instanceof DefinitionStmt) {
  DefinitionStmt ds = (DefinitionStmt) s;
  Value lhs = ds.getLeftOp();
  Value rhs = ds.getRightOp();
  if (lhs instanceof Local) {
   HashSet<NewExpr> lv = new HashSet<NewExpr>();
   out.put((Local) lhs, lv);
   if (rhs instanceof NewExpr) {
    lv.add((NewExpr) rhs);
   } else if (rhs instanceof Local) {
    lv.addAll(in.get(rhs));
   } else {
    lv.add(UNKNOWN);
   }
  }
 }
}
origin: commons-pool/commons-pool

/**
 * Clears the pool, removing all pooled instances.
 */
@Override
public synchronized void clear() {
  Iterator<K> it = _pools.keySet().iterator();
  while(it.hasNext()) {
    K key = it.next();
    Stack<V> stack = _pools.get(key);
    destroyStack(key,stack);
  }
  _totIdle = 0;
  _pools.clear();
  _activeCount.clear();
}
origin: com.h2database/h2

private void removeOldTempIndexes() {
  if (tempObjects != null) {
    metaObjects.putAll(tempObjects);
    for (PageIndex index: tempObjects.values()) {
      if (index.getTable().isTemporary()) {
        index.truncate(pageStoreSession);
        index.remove(pageStoreSession);
      }
    }
    pageStoreSession.commit(true);
    tempObjects = null;
  }
  metaObjects.clear();
  metaObjects.put(-1, metaIndex);
}
origin: i2p/i2p.i2p

/**
 * Remove and hard close all the socket handlers managed by this SAM
 * STREAM session.
 *
 */
private void removeAllSocketHandlers() {
  synchronized (handlersMap) {
    for (Map.Entry<Integer, SAMStreamSessionSocketReader> e : handlersMap.entrySet()) {
       Integer id = e.getKey();
       e.getValue().stopRunning();
       sendersMap.get(id).shutDownGracefully();
    }
    handlersMap.clear();
    sendersMap.clear();
  }
}
origin: org.apache.hadoop/hadoop-hdfs

 builder.append("[");
CHOOSE_RANDOM_REASONS.get().clear();
boolean badTarget = false;
DatanodeStorageInfo firstChosen = null;
   if (includeType != null && entry.getKey() != includeType) {
    continue;
     chosenNode, blocksize, results, entry.getKey());
   if (storage != null) {
    numOfReplicas--;
    int num = entry.getValue();
    if (num == 1) {
     iter.remove();
origin: looly/hutool

super.clear();
BufferedReader reader = null;
try {
      valueSet = super.get(group);
      if (null == valueSet) {
        valueSet = new LinkedHashSet<String>();
      super.put(group, valueSet);
      continue;
      super.put(StrUtil.EMPTY, valueSet);
origin: lealone/Lealone

/**
 * Set the source code for the specified class.
 * This will reset all compiled classes.
 *
 * @param className the class name
 * @param source the source code
 */
public void setSource(String className, String source) {
  sources.put(className, source);
  compiled.clear();
}
origin: apache/geode

 nodeToBuckets.entrySet().iterator(); itr.hasNext();) {
Map.Entry<InternalDistributedMember, HashMap<Integer, HashSet>> entry = itr.next();
HashMap<Integer, HashSet> bucketKeys = entry.getValue();
FetchBulkEntriesResponse fber = null;
result = new HashSet();
for (Map.Entry<Integer, HashSet> e : bucketKeys.entrySet()) {
 result.clear();
 oneBucketKeys.clear();
 oneBucketKeys.put(e.getKey(), e.getValue());
 try {
  if (entry.getKey().getVersionObject().compareTo(Version.GFE_80) < 0) {
   failures.putAll(nodeToBuckets.get(entry.getKey()));
   continue;
  if (fber.getFailedBucketIds() != null && !fber.getFailedBucketIds().isEmpty()) {
   for (int id : fber.getFailedBucketIds()) {
    failures.put(id, nodeToBuckets.get(entry.getKey()).get(id));
  failures.put(e.getKey(), e.getValue());
origin: fesh0r/fernflower

  mapEdges.put(newedge.getDestination(), new ArrayList<>(Collections.singletonList(newedge)));
for (Entry<Statement, List<StatEdge>> entr : mapEdges.entrySet()) {
 if (entr.getKey() == next) {
  for (StatEdge edge : entr.getValue()) {
   edge.explicit = false;
 for (Entry<Statement, List<StatEdge>> entr : mapEdges.entrySet()) {
  if (entr.getKey().type != Statement.TYPE_DUMMYEXIT &&
    (lstEdges == null || entr.getValue().size() > lstEdges.size())) {
   lstEdges = entr.getValue();
mapEdges.clear();
mapEdges.put(statedge.getDestination(), new ArrayList<>(Collections.singletonList(statedge)));
origin: prestodb/presto

deser = _incompleteDeserializers.get(type);
if (deser != null) {
  return deser;
  _incompleteDeserializers.clear();
origin: wildfly/wildfly

/**
 * Clear the map.
 * <p>
 * This clears each collection in the map, and so may be slow.
 */
public void clear() {
  // For gc, clear each list in the map
  Set pairs = super.entrySet();
  Iterator pairsIterator = pairs.iterator();
  while (pairsIterator.hasNext()) {
    Map.Entry keyValuePair = (Map.Entry) pairsIterator.next();
    Collection coll = (Collection) keyValuePair.getValue();
    coll.clear();
  }
  super.clear();
}
origin: org.apache.zookeeper/zookeeper

String clientPortAddress = null;
for (Entry<Object, Object> entry : zkProp.entrySet()) {
  String key = entry.getKey().toString().trim();
  String value = entry.getValue().toString().trim();
  if (key.equals("dataDir")) {
    dataDir = value;
      observers.put(Long.valueOf(sid), new QuorumServer(sid, hostname, port, electionPort, type));
    } else {
      servers.put(Long.valueOf(sid), new QuorumServer(sid, hostname, port, electionPort, type));
        throw new ConfigException("Server " + sid + "is in multiple groups");
      else
        serverGroup.put(sid, gid);
  servers.clear();
} else if (servers.size() > 1) {
  if (servers.size() == 2) {
origin: apache/accumulo

mincIdleThresholds.clear();
final MemoryManagementActions result = new MemoryManagementActions();
result.tabletsToMinorCompact = new ArrayList<>();
  for (TabletInfo largest : lastEntry.getValue()) {
   toBeCompacted += largest.memTableSize;
   result.tabletsToMinorCompact.add(largest.extent);
   i++;
  largestMemTablets.remove(lastEntry.getKey());
origin: chentao0707/SimplifyReader

private void buildImagesBucketList() {
  getThumbnail();
  mBucketList.clear();
      String bucketId = cursor.getString(bucketIdIndex);
      ImageBucket bucket = mBucketList.get(bucketId);
      if (bucket == null) {
        bucket = new ImageBucket();
        mBucketList.put(bucketId, bucket);
        bucket.bucketList = new ArrayList<ImageItem>();
        bucket.bucketName = bucketName;
      imageItem.setImageId(_id);
      imageItem.setImagePath(path);
      imageItem.setThumbnailPath(mThumbnailList.get(_id));
      bucket.bucketList.add(imageItem);
origin: chentao0707/SimplifyReader

private void getThumbnailColumnData(Cursor cur) {
  mThumbnailList.clear();
  if (cur.moveToFirst()) {
    int image_id;
    int image_idColumn = cur.getColumnIndex(Thumbnails.IMAGE_ID);
    int dataColumn = cur.getColumnIndex(Thumbnails.DATA);
    String image_path;
    do {
      image_id = cur.getInt(image_idColumn);
      image_path = cur.getString(dataColumn);
      mThumbnailList.put("" + image_id, image_path);
    } while (cur.moveToNext());
  }
}
origin: Sable/soot

@Override
protected void flowThrough(HashMap<Value, Integer> in, Unit u, HashMap<Value, Integer> out) {
 Stmt s = (Stmt) u;
 out.clear();
   if (rhs instanceof Local) {
    Integer val = in.get(rhs);
    if (val != null) {
     out.put(lhs, val);
    out.put(lhs, thisRefNumber());
   } else if (rhs instanceof ParameterRef) {
    out.put(lhs, parameterRefNumber((ParameterRef) rhs));
   } else {
java.utilHashMapclear

Javadoc

Removes all mappings from this hash map, leaving it empty.

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
  • remove
  • 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.
  • 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
  • Top PhpStorm 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