当前位置: 首页>>代码示例>>Java>>正文


Java Hashtable.elements方法代码示例

本文整理汇总了Java中java.util.Hashtable.elements方法的典型用法代码示例。如果您正苦于以下问题:Java Hashtable.elements方法的具体用法?Java Hashtable.elements怎么用?Java Hashtable.elements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Hashtable的用法示例。


在下文中一共展示了Hashtable.elements方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeForwardReferences

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Write forward references for referenced interfaces and valuetypes
 * ...but not if the reference is to a boxed IDLEntity,
 * @param refHash Hashtable loaded with referenced types
 * @param p The output stream.
 */
protected void writeForwardReferences(
                                      Hashtable refHash,
                                      IndentingWriter p )
    throws IOException {
    Enumeration refEnum = refHash.elements();
    nextReference:
    while ( refEnum.hasMoreElements() ) {
        Type t = (Type)refEnum.nextElement();
        if ( t.isCompound() ) {
            CompoundType ct = (CompoundType)t;
            if ( ct.isIDLEntity() )
                continue nextReference;                  //ignore IDLEntity reference
        }
        writeForwardReference( t,p );
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:IDLGenerator.java

示例2: main

import java.util.Hashtable; //导入方法依赖的package包/类
public static void main(String[] args) {

    //create Hashtable object
    Hashtable ht = new Hashtable();

    //add key value pairs to Hashtable
    ht.put("1", "One");
    ht.put("2", "Two");
    ht.put("3", "Three");

    /*
      get Enumeration of values contained in Hashtable using
      Enumeration elements() method of Hashtable class
    */
    Enumeration e = ht.elements();

    //iterate through Hashtable values Enumeration
    while (e.hasMoreElements()) System.out.println(e.nextElement());
  }
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:20,代码来源:IterateValuesOfHashtableExample.java

示例3: writeIDLEntityIncludes

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Write #includes for boxed IDLEntity references.
 * @param refHash Hashtable loaded with referenced types
 * @param p The output stream.
 */
protected void writeIDLEntityIncludes(
                                      Hashtable refHash,
                                      IndentingWriter p )
    throws IOException {
    Enumeration refEnum = refHash.elements();
    while ( refEnum.hasMoreElements() ) {
        Type t = (Type)refEnum.nextElement();
        if ( t.isCompound() ) {
            CompoundType ct = (CompoundType)t;
            if ( ct.isIDLEntity() ) {                          //select IDLEntities
                writeInclude( ct,0,!isThrown,p );
                refHash.remove( ct.getQualifiedName() );     //avoid another #include
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:IDLGenerator.java

示例4: writeBoxedRMIIncludes

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Write includes for boxedRMI valuetypes for IDL sequences.
 * Write only the maximum dimension found for an ArrayType.
 * @param arrHash Hashtable loaded with array types
 * @param p The output stream.
 */
protected void writeBoxedRMIIncludes(
                                     Hashtable arrHash,
                                     IndentingWriter p)
    throws IOException {
    Enumeration e1 = arrHash.elements();
    nextSequence:
    while ( e1.hasMoreElements() ) {
        ArrayType at = (ArrayType)e1.nextElement();
        int dim = at.getArrayDimension();
        Type et = at.getElementType();

        Enumeration e2 = arrHash.elements();
        while ( e2.hasMoreElements() ) {                   //eliminate duplicates
            ArrayType at2 = (ArrayType)e2.nextElement();
            if ( et == at2.getElementType() &&                //same element type &
                 dim < at2.getArrayDimension() )               //smaller dimension?
                continue nextSequence;                              //ignore this one
    }
        writeInclude( at,dim,!isThrown,p );
}
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:IDLGenerator.java

示例5: resetAll

import java.util.Hashtable; //导入方法依赖的package包/类
private static void resetAll(Hashtable inboundFlight)
{
    Enumeration e = inboundFlight.elements();
    while (e.hasMoreElements())
    {
        ((DTLSReassembler)e.nextElement()).reset();
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:9,代码来源:DTLSReliableHandshake.java

示例6: findAttrNamesForOID

import java.util.Hashtable; //导入方法依赖的package包/类
public static String[] findAttrNamesForOID(
    ASN1ObjectIdentifier oid,
    Hashtable            lookup)
{
    int count = 0;
    for (Enumeration en = lookup.elements(); en.hasMoreElements();)
    {
        if (oid.equals(en.nextElement()))
        {
            count++;
        }
    }

    String[] aliases = new String[count];
    count = 0;

    for (Enumeration en = lookup.keys(); en.hasMoreElements();)
    {
        String key = (String)en.nextElement();
        if (oid.equals(lookup.get(key)))
        {
            aliases[count++] = key;
        }
    }

    return aliases;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:28,代码来源:IETFUtils.java

示例7: writeIncludes

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Write #includes
 * @param incHash Hashtable loaded with Types to include
 * @param isThrown true if Types are thrown exceptions
 * @param p The output stream.
 */
protected void writeIncludes(
                             Hashtable incHash,
                             boolean isThrown,
                             IndentingWriter p )
    throws IOException {
    Enumeration incEnum = incHash.elements();
    while ( incEnum.hasMoreElements() ) {
        CompoundType t = (CompoundType)incEnum.nextElement();
        writeInclude( t,0,isThrown,p );
        }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:IDLGenerator.java

示例8: entest2

import java.util.Hashtable; //导入方法依赖的package包/类
static void entest2(Hashtable ht, int size) {
    int sum = 0;
    timer.start("Iter Enumeration Value ", size);
    for (Enumeration en = ht.elements(); en.hasMoreElements(); ) {
        if (en.nextElement() != MISSING)
            ++sum;
    }
    timer.finish();
    reallyAssert(sum == size);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:MapCheck.java

示例9: getFiles

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Returns list of files given a package name and extension.
 */
public Enumeration<ClassFile> getFiles(String pkg, String ext) {
    Hashtable<String, ClassFile> files = new Hashtable<>();
    for (int i = path.length; --i >= 0; ) {
        path[i].fillFiles(pkg, ext, files);
    }
    return files.elements();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:ClassPath.java

示例10: readObject

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * readObject is called to restore the state of the
 * BasicPermissionCollection from a stream.
 */
private void readObject(java.io.ObjectInputStream in)
     throws IOException, ClassNotFoundException
{
    // Don't call defaultReadObject()

    // Read in serialized fields
    ObjectInputStream.GetField gfields = in.readFields();

    // Get permissions
    // writeObject writes a Hashtable<String, Permission> for the
    // permissions key, so this cast is safe, unless the data is corrupt.
    @SuppressWarnings("unchecked")
    Hashtable<String, Permission> permissions =
            (Hashtable<String, Permission>)gfields.get("permissions", null);
    perms = new HashMap<String, Permission>(permissions.size()*2);
    perms.putAll(permissions);

    // Get all_allowed
    all_allowed = gfields.get("all_allowed", false);

    // Get permClass
    permClass = (Class<?>) gfields.get("permClass", null);

    if (permClass == null) {
        // set permClass
        Enumeration<Permission> e = permissions.elements();
        if (e.hasMoreElements()) {
            Permission p = e.nextElement();
            permClass = p.getClass();
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:37,代码来源:BasicPermission.java

示例11: writeInheritedIncludes

import java.util.Hashtable; //导入方法依赖的package包/类
/**
 * Write #includes
 * @param incHash Hashtable loaded with Types to include
 * @param p The output stream.
 */
protected void writeInheritedIncludes(
                                      Hashtable inhHash,
                             IndentingWriter p )
    throws IOException {
    Enumeration inhEnum = inhHash.elements();
    while ( inhEnum.hasMoreElements() ) {
        CompoundType t = (CompoundType)inhEnum.nextElement();
        writeInclude( t,0,!isThrown,p );
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:IDLGenerator.java

示例12: entest2

import java.util.Hashtable; //导入方法依赖的package包/类
static void entest2(Hashtable ht, int size) {
  int sum = 0;
  timer.start("Iter Enumeration Value ", size);
  for (Enumeration en = ht.elements(); en.hasMoreElements();) {
    if (en.nextElement() != MISSING)
      ++sum;
  }
  timer.finish();
  reallyAssert(sum == size);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:11,代码来源:MapCheckJUnitTest.java

示例13: entest4

import java.util.Hashtable; //导入方法依赖的package包/类
static void entest4(Hashtable ht, int size) {
  int sum = 0;
  timer.start("Iterf Enumeration Value", size);
  Enumeration en = ht.elements();
  for (int i = 0; i < size; ++i) {
    if (en.nextElement() != MISSING)
      ++sum;
  }
  timer.finish();
  reallyAssert(sum == size);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:12,代码来源:IntMapCheckJUnitTest.java

示例14: ReachableObjects

import java.util.Hashtable; //导入方法依赖的package包/类
public ReachableObjects(JavaHeapObject root,
                        final ReachableExcludes excludes) {
    this.root = root;

    final Hashtable<JavaHeapObject, JavaHeapObject> bag = new Hashtable<JavaHeapObject, JavaHeapObject>();
    final Hashtable<String, String> fieldsExcluded = new Hashtable<String, String>();  //Bag<String>
    final Hashtable<String, String> fieldsUsed = new Hashtable<String, String>();   // Bag<String>
    JavaHeapObjectVisitor visitor = new AbstractJavaHeapObjectVisitor() {
        public void visit(JavaHeapObject t) {
            // Size is zero for things like integer fields
            if (t != null && t.getSize() > 0 && bag.get(t) == null) {
                bag.put(t, t);
                t.visitReferencedObjects(this);
            }
        }

        public boolean mightExclude() {
            return excludes != null;
        }

        public boolean exclude(JavaClass clazz, JavaField f) {
            if (excludes == null) {
                return false;
            }
            String nm = clazz.getName() + "." + f.getName();
            if (excludes.isExcluded(nm)) {
                fieldsExcluded.put(nm, nm);
                return true;
            } else {
                fieldsUsed.put(nm, nm);
                return false;
            }
        }
    };
    // Put the closure of root and all objects reachable from root into
    // bag (depth first), but don't include root:
    visitor.visit(root);
    bag.remove(root);

    // Now grab the elements into a vector, and sort it in decreasing size
    JavaThing[] things = new JavaThing[bag.size()];
    int i = 0;
    for (Enumeration e = bag.elements(); e.hasMoreElements(); ) {
        things[i++] = (JavaThing) e.nextElement();
    }
    ArraySorter.sort(things, new Comparer() {
        public int compare(Object lhs, Object rhs) {
            JavaThing left = (JavaThing) lhs;
            JavaThing right = (JavaThing) rhs;
            int diff = right.getSize() - left.getSize();
            if (diff != 0) {
                return diff;
            }
            return left.compareTo(right);
        }
    });
    this.reachables = things;

    this.totalSize = root.getSize();
    for (i = 0; i < things.length; i++) {
        this.totalSize += things[i].getSize();
    }

    excludedFields = getElements(fieldsExcluded);
    usedFields = getElements(fieldsUsed);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:67,代码来源:ReachableObjects.java

示例15: ReachableObjects

import java.util.Hashtable; //导入方法依赖的package包/类
public ReachableObjects(JavaHeapObject root,
                        final ReachableExcludes excludes) {
    this.root = root;

    final Hashtable<JavaHeapObject, JavaHeapObject> bag = new Hashtable<JavaHeapObject, JavaHeapObject>();
    final Hashtable<String, String> fieldsExcluded = new Hashtable<String, String>();  //Bag<String>
    final Hashtable<String, String> fieldsUsed = new Hashtable<String, String>();   // Bag<String>
    JavaHeapObjectVisitor visitor = new AbstractJavaHeapObjectVisitor() {
        public void visit(JavaHeapObject t) {
            // Size is zero for things like integer fields
            if (t != null && t.getSize() > 0 && bag.get(t) == null) {
                bag.put(t, t);
                t.visitReferencedObjects(this);
            }
        }

        public boolean mightExclude() {
            return excludes != null;
        }

        public boolean exclude(JavaClass clazz, JavaField f) {
            if (excludes == null) {
                return false;
            }
            String nm = clazz.getName() + "." + f.getName();
            if (excludes.isExcluded(nm)) {
                fieldsExcluded.put(nm, nm);
                return true;
            } else {
                fieldsUsed.put(nm, nm);
                return false;
            }
        }
    };
    // Put the closure of root and all objects reachable from root into
    // bag (depth first), but don't include root:
    visitor.visit(root);
    bag.remove(root);

    // Now grab the elements into a vector, and sort it in decreasing size
    JavaThing[] things = new JavaThing[bag.size()];
    int i = 0;
    for (Enumeration<JavaHeapObject> e = bag.elements(); e.hasMoreElements(); ) {
        things[i++] = (JavaThing) e.nextElement();
    }
    ArraySorter.sort(things, new Comparer() {
        public int compare(Object lhs, Object rhs) {
            JavaThing left = (JavaThing) lhs;
            JavaThing right = (JavaThing) rhs;
            long diff = right.getSize() - left.getSize();
            if (diff != 0) {
                return Long.signum(diff);
            }
            return left.compareTo(right);
        }
    });
    this.reachables = things;

    this.totalSize = root.getSize();
    for (i = 0; i < things.length; i++) {
        this.totalSize += things[i].getSize();
    }

    excludedFields = getElements(fieldsExcluded);
    usedFields = getElements(fieldsUsed);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:67,代码来源:ReachableObjects.java


注:本文中的java.util.Hashtable.elements方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。