本文整理了Java中java.util.Hashtable.elements()
方法的一些代码示例,展示了Hashtable.elements()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hashtable.elements()
方法的具体详情如下:
包路径:java.util.Hashtable
类名称:Hashtable
方法名:elements
[英]Returns an enumeration on the values of this Hashtable. The results of the Enumeration may be affected if the contents of this Hashtable are modified.
[中]返回此哈希表值的枚举。如果修改此哈希表的内容,枚举结果可能会受到影响。
代码示例来源:origin: apache/rocketmq
public Enumeration getCurrentLoggers() {
Vector<Logger> loggers = new Vector<Logger>(ht.size());
Enumeration elems = ht.elements();
while (elems.hasMoreElements()) {
Object o = elems.nextElement();
if (o instanceof Logger) {
Logger logger = (Logger)o;
loggers.addElement(logger);
}
}
return loggers.elements();
}
代码示例来源:origin: redisson/redisson
/**
* This method is periodically invoked so that memory
* footprint will be minimized.
*/
void compress() {
if (compressCount++ > COMPRESS_THRESHOLD) {
compressCount = 0;
Enumeration e = classes.elements();
while (e.hasMoreElements())
((CtClass)e.nextElement()).compress();
}
}
代码示例来源:origin: commons-collections/commons-collections
public void testToListWithHashtable() {
Hashtable expected = new Hashtable();
expected.put("one", new Integer(1));
expected.put("two", new Integer(2));
expected.put("three", new Integer(3));
// validate elements.
List actualEltList = EnumerationUtils.toList(expected.elements());
Assert.assertEquals(expected.size(), actualEltList.size());
Assert.assertTrue(actualEltList.contains(new Integer(1)));
Assert.assertTrue(actualEltList.contains(new Integer(2)));
Assert.assertTrue(actualEltList.contains(new Integer(3)));
List expectedEltList = new ArrayList();
expectedEltList.add(new Integer(1));
expectedEltList.add(new Integer(2));
expectedEltList.add(new Integer(3));
Assert.assertTrue(actualEltList.containsAll(expectedEltList));
// validate keys.
List actualKeyList = EnumerationUtils.toList(expected.keys());
Assert.assertEquals(expected.size(), actualEltList.size());
Assert.assertTrue(actualKeyList.contains("one"));
Assert.assertTrue(actualKeyList.contains("two"));
Assert.assertTrue(actualKeyList.contains("three"));
List expectedKeyList = new ArrayList();
expectedKeyList.add("one");
expectedKeyList.add("two");
expectedKeyList.add("three");
Assert.assertTrue(actualKeyList.containsAll(expectedKeyList));
}
代码示例来源:origin: apache/felix
public BundleInfo[] getAllBundles() {
Enumeration b = bundles.elements();
BundleInfo[] binfo = new BundleInfo[bundles.size()];
for (int i = 0; i < binfo.length; i++) {
binfo[i] = (BundleInfo) b.nextElement();
}
return binfo;
}
代码示例来源:origin: log4j/log4j
/**
Returns all the currently defined categories in this hierarchy as
an {@link java.util.Enumeration Enumeration}.
<p>The root logger is <em>not</em> included in the returned
{@link Enumeration}. */
public
Enumeration getCurrentLoggers() {
// The accumlation in v is necessary because not all elements in
// ht are Logger objects as there might be some ProvisionNodes
// as well.
Vector v = new Vector(ht.size());
Enumeration elems = ht.elements();
while(elems.hasMoreElements()) {
Object o = elems.nextElement();
if(o instanceof Logger) {
v.addElement(o);
}
}
return v.elements();
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Cleans up any resources held by this classloader. Any open archive
* files are closed.
*/
public synchronized void cleanup() {
for (Enumeration e = jarFiles.elements(); e.hasMoreElements();) {
JarFile jarFile = (JarFile) e.nextElement();
try {
jarFile.close();
} catch (IOException ioe) {
// ignore
}
}
jarFiles = new Hashtable();
if (project != null) {
project.removeBuildListener(this);
}
project = null;
}
代码示例来源:origin: apache/felix
public ServiceInfo[] getAllServiceInfo() {
Enumeration s = services.elements();
ServiceInfo[] sinfo = new ServiceInfo[services.size()];
for (int i = 0; i < sinfo.length; i++) {
sinfo[i] = (ServiceInfo) s.nextElement();
}
return sinfo;
}
代码示例来源:origin: javahongxi/whatsmars
public Enumeration getCurrentLoggers() {
Vector<Logger> loggers = new Vector<Logger>(ht.size());
Enumeration elems = ht.elements();
while (elems.hasMoreElements()) {
Object o = elems.nextElement();
if (o instanceof Logger) {
Logger logger = (Logger)o;
loggers.addElement(logger);
}
}
return loggers.elements();
}
代码示例来源:origin: robovm/robovm
/**
* Get required elements that were not found.
*
* @return required elements that were not found.
*/
String getRequiredElem()
{
if (m_requiredFound == null)
return null;
Enumeration elems = m_requiredFound.elements();
String s = "";
boolean first = true;
while (elems.hasMoreElements())
{
if (first)
first = false;
else
s = s + ", ";
s = s + (String)elems.nextElement();
}
return s;
}
代码示例来源:origin: apache/felix
public PackageInfo[] getAllPackageInfo() {
Enumeration p = packages.elements();
PackageInfo[] pinfo = new PackageInfo[packages.size()];
for (int i = 0; i < pinfo.length; i++) {
pinfo[i] = (PackageInfo) p.nextElement();
}
return pinfo;
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
Returns all the currently defined categories in this hierarchy as
an {@link java.util.Enumeration Enumeration}.
<p>The root logger is <em>not</em> included in the returned
{@link Enumeration}. */
public
Enumeration getCurrentLoggers() {
// The accumlation in v is necessary because not all elements in
// ht are Logger objects as there might be some ProvisionNodes
// as well.
Vector v = new Vector(ht.size());
Enumeration elems = ht.elements();
while(elems.hasMoreElements()) {
Object o = elems.nextElement();
if(o instanceof Logger) {
v.addElement(o);
}
}
return v.elements();
}
代码示例来源:origin: org.javassist/javassist
/**
* This method is periodically invoked so that memory
* footprint will be minimized.
*/
void compress() {
if (compressCount++ > COMPRESS_THRESHOLD) {
compressCount = 0;
Enumeration e = classes.elements();
while (e.hasMoreElements())
((CtClass)e.nextElement()).compress();
}
}
代码示例来源:origin: org.openmobster.core/device-agent-frameworks
public String getValue()
{
if(this.properties.size() == 1)
{
String key = (String)this.properties.keys().nextElement();
if(key.trim().length()==0 ||
this.calculatePropertyUri(this.listProperty).endsWith(key.trim()))
{
return (String)this.properties.elements().nextElement();
}
}
return null;
}
代码示例来源:origin: apache/log4j
/**
Returns all the currently defined categories in this hierarchy as
an {@link java.util.Enumeration Enumeration}.
<p>The root logger is <em>not</em> included in the returned
{@link Enumeration}. */
public
Enumeration getCurrentLoggers() {
// The accumlation in v is necessary because not all elements in
// ht are Logger objects as there might be some ProvisionNodes
// as well.
Vector v = new Vector(ht.size());
Enumeration elems = ht.elements();
while(elems.hasMoreElements()) {
Object o = elems.nextElement();
if(o instanceof Logger) {
v.addElement(o);
}
}
return v.elements();
}
代码示例来源:origin: scouter-project/scouter
/**
* This method is periodically invoked so that memory
* footprint will be minimized.
*/
void compress() {
if (compressCount++ > COMPRESS_THRESHOLD) {
compressCount = 0;
Enumeration e = classes.elements();
while (e.hasMoreElements())
((CtClass)e.nextElement()).compress();
}
}
代码示例来源:origin: org.ow2.joram/a3-rt
/**
* Method used for debug and monitoring. It returns an enumeration
* of all agents loaded in memory.
*/
AgentId[] getLoadedAgentIdlist() {
AgentId list[] = new AgentId[agents.size()];
int i = 0;
for (Enumeration<Agent> e = agents.elements(); e.hasMoreElements() ;)
list[i++] = e.nextElement().id;
return list;
}
代码示例来源:origin: scouter-project/scouter
/**
* This method is periodically invoked so that memory
* footprint will be minimized.
*/
void compress() {
if (compressCount++ > COMPRESS_THRESHOLD) {
compressCount = 0;
Enumeration e = classes.elements();
while (e.hasMoreElements())
((CtClass)e.nextElement()).compress();
}
}
代码示例来源:origin: org.nakedobjects/metamodel
public NakedObjectSpecification[] allSpecifications() {
final int size = specs.size();
final NakedObjectSpecification[] cls = new NakedObjectSpecification[size];
final Enumeration e = specs.elements();
int i = 0;
while (e.hasMoreElements()) {
cls[i++] = (NakedObjectSpecification) e.nextElement();
}
return cls;
}
}
代码示例来源:origin: xalan/xalan
/**
* Get required elements that were not found.
*
* @return required elements that were not found.
*/
String getRequiredElem()
{
if (m_requiredFound == null)
return null;
Enumeration elems = m_requiredFound.elements();
String s = "";
boolean first = true;
while (elems.hasMoreElements())
{
if (first)
first = false;
else
s = s + ", ";
s = s + (String)elems.nextElement();
}
return s;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-designer
public Action[] getBoundActions() {
Action[] actions = new Action[bindings.size()];
int i = 0;
for (Enumeration<Action> e = bindings.elements(); e.hasMoreElements();) {
actions[i++] = e.nextElement();
}
return actions;
}
内容来源于网络,如有侵权,请联系作者删除!