java.util.Hashtable.clear()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(195)

本文整理了Java中java.util.Hashtable.clear()方法的一些代码示例,展示了Hashtable.clear()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hashtable.clear()方法的具体详情如下:
包路径:java.util.Hashtable
类名称:Hashtable
方法名:clear

Hashtable.clear介绍

[英]Removes all key/value pairs from this Hashtable, leaving the size zero and the capacity unchanged.
[中]从此哈希表中删除所有键/值对,保留大小为零和容量不变。

代码示例

代码示例来源:origin: spring-projects/spring-framework

/**
 * Clear all bindings in this context builder, while keeping it active.
 */
public void clear() {
  this.boundObjects.clear();
}

代码示例来源:origin: log4j/log4j

/**
  This call will clear all logger definitions from the internal
  hashtable. Invoking this method will irrevocably mess up the
  logger hierarchy.
  <p>You should <em>really</em> know what you are doing before
  invoking this method.
  @since 0.9.0 */
public
void clear() {
 //System.out.println("\n\nAbout to clear internal hash table.");
 ht.clear();
}

代码示例来源:origin: log4j/log4j

public
void clear() {
 map.clear();
}

代码示例来源:origin: Atmosphere/atmosphere

public static void clear() {
  objectMethods.clear();
}

代码示例来源:origin: pentaho/pentaho-kettle

public void clear() {
  counterTable.clear();
 }
}

代码示例来源:origin: robovm/robovm

/**
 * Clear all parameters set with setParameter.
 */
public void clearParameters()
{
 if (null == m_params)
  return;
 m_params.clear();
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Clear all bindings in this context builder, while keeping it active.
 */
public void clear() {
  this.boundObjects.clear();
}

代码示例来源:origin: eclipsesource/J2V8

@Override
public void clear() {
  map.clear();
  nulls.clear();
}

代码示例来源:origin: robovm/robovm

/**
 * Sets the stream handler factory for this VM.
 *
 * @throws Error if a URLStreamHandlerFactory has already been installed
 *     for the current VM.
 */
public static synchronized void setURLStreamHandlerFactory(URLStreamHandlerFactory factory) {
  if (streamHandlerFactory != null) {
    throw new Error("Factory already set");
  }
  streamHandlers.clear();
  streamHandlerFactory = factory;
}

代码示例来源:origin: commons-logging/commons-logging

/**
 * Release any internal references to previously created
 * {@link org.apache.commons.logging.Log}
 * instances returned by this factory.  This is useful in environments
 * like servlet containers, which implement application reloading by
 * throwing away a ClassLoader.  Dangling references to objects in that
 * class loader would prevent garbage collection.
 */
public void release() {
  logDiagnostic("Releasing all known loggers");
  instances.clear();
}

代码示例来源:origin: log4j/log4j

private
void clear0() {
 if(!java1 && tlm != null) {
  Hashtable ht = (Hashtable) ((ThreadLocalMap)tlm).get();
  if(ht != null) {
   ht.clear();
  }
  if(removeMethod != null) {
    // java 1.3/1.4 does not have remove - will suffer from a memory leak
    try {
     removeMethod.invoke(tlm, null);
    } catch (IllegalAccessException e) {
     // should not happen
    } catch (InvocationTargetException e) {
     // should not happen
    }
  }
 }
}

代码示例来源:origin: org.javassist/javassist

/**
 * Close the class pool
 */
public void close() {
  this.removeClassPath(classPath);
  classes.clear();
  softcache.clear();
}

代码示例来源:origin: robovm/robovm

/**
 * Release any internal references to previously created
 * {@link org.apache.commons.logging.Log}
 * instances returned by this factory.  This is useful in environments
 * like servlet containers, which implement application reloading by
 * throwing away a ClassLoader.  Dangling references to objects in that
 * class loader would prevent garbage collection.
 */
public void release() {
  logDiagnostic("Releasing all known loggers");
  instances.clear();
}

代码示例来源:origin: scouter-project/scouter

/**
 * Close the class pool
 */
public void close() {
  this.removeClassPath(classPath);
  classes.clear();
  softcache.clear();
}

代码示例来源:origin: robovm/robovm

final void reset()
{
  this.count = 0;
  this.m_namespaces.clear();
  this.m_nodeStack.clear();        
  
  initNamespaces();
}

代码示例来源:origin: redisson/redisson

/**
 * Close the class pool
 */
public void close() {
  this.removeClassPath(classPath);
  classPath.close();
  classes.clear();
  softcache.clear();
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

void clearURLHandlers() throws Exception {
  final Field handlersFields = URL.class.getDeclaredField("handlers");
  if (handlersFields != null) {
    if (!handlersFields.isAccessible()) {
      handlersFields.setAccessible(true);
    }
    @SuppressWarnings("unchecked")
    final
    Hashtable<String, URLStreamHandler> handlers = (Hashtable<String, URLStreamHandler>) handlersFields
        .get(null);
    if (handlers != null) {
      handlers.clear();
    }
  }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void addAllToSelection() {
 // Just remove it all from both lists
 // Then add input[] to the destination list...
 // This is much faster.
 wListSource.removeAll();
 wListDest.removeAll();
 selection.clear();
 for ( int i = 0; i < input.length; i++ ) {
  wListDest.add( input[i] );
  selection.put( Integer.valueOf( i ), input[i] );
 }
 setPageComplete( canFlipToNextPage() );
}

代码示例来源:origin: scouter-project/scouter

/**
 * Close the class pool
 */
public void close() {
  this.removeClassPath(classPath);
  classPath.close();
  classes.clear();
  softcache.clear();
}

代码示例来源:origin: pentaho/pentaho-kettle

public void removeAllFromSelection() {
 // Just remove it all from both lists
 // Then add input[] to the source list...
 // This is much faster.
 wListSource.removeAll();
 wListDest.removeAll();
 selection.clear();
 for ( int i = 0; i < input.length; i++ ) {
  wListSource.add( input[i] );
 }
 setPageComplete( canFlipToNextPage() );
}

相关文章