Example usage for java.util Enumeration hasMoreElements

List of usage examples for java.util Enumeration hasMoreElements

Introduction

In this page you can find the example usage for java.util Enumeration hasMoreElements.

Prototype

boolean hasMoreElements();

Source Link

Document

Tests if this enumeration contains more elements.

Usage

From source file:MainClass.java

public static void main(String[] args) throws IOException {
    ZipFile zf = new ZipFile("test.zip");
    Enumeration e = zf.entries();
    while (e.hasMoreElements()) {
        ZipEntry ze2 = (ZipEntry) e.nextElement();
        System.out.println("File: " + ze2);
    }/*from   w  w  w . j ava  2  s. c  om*/
}

From source file:MainClass.java

public static void main(String args[]) {
    Vector<String> v = new Vector<String>();
    v.add("A");// w  ww  .j  a v  a 2  s  . co m
    v.add("B");

    Enumeration e = v.elements();
    while (e.hasMoreElements()) {
        System.out.println(e.nextElement());
    }
}

From source file:Main.java

public static void main(String[] args) throws IOException {
    JarFile jf = new JarFile(args[0]);
    Enumeration e = jf.entries();
    while (e.hasMoreElements()) {
        JarEntry je = (JarEntry) e.nextElement();
        String name = je.getName();
        System.out.println(name);
    }//from  w ww  . ja  va  2 s.  c  om
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Properties config = new Properties();
    config.load(new FileInputStream("conf-file.pros"));

    Enumeration en = config.keys();
    while (en.hasMoreElements()) {
        String key = (String) en.nextElement();
        System.out.println(key + ":" + config.get(key));
    }/* w  w  w  . j  a v  a 2 s .  co  m*/
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    ProtectionDomain domain = String.class.getProtectionDomain();
    PermissionCollection pcoll = Policy.getPolicy().getPermissions(domain);
    Enumeration e = pcoll.elements();
    for (; e.hasMoreElements();) {
        Permission p = (Permission) e.nextElement();
    }/* ww w  .ja va2s .  c o  m*/
}

From source file:MainClass.java

public static void main(String[] args) throws IOException {

    JarFile jf = new JarFile(args[0]);
    Enumeration e = jf.entries();
    while (e.hasMoreElements()) {
        JarEntry je = (JarEntry) e.nextElement();
        String name = je.getName();
        System.out.println(name);
    }/*from w w  w.  j  a v a 2 s. c om*/
}

From source file:MainClass.java

public static void main(String args[]) throws Exception {
    Vector v = new Vector();
    v.add("a");//from   www.ja  v a 2s.co m
    v.add("b");
    v.add("c");

    Enumeration e = v.elements();
    while (e.hasMoreElements()) {
        Object o = e.nextElement();
        System.out.println(o);
    }
}

From source file:MainClass.java

public static void main(String[] s) {
    Hashtable table = new Hashtable();
    table.put("key1", "value1");
    table.put("key2", "value2");
    table.put("key3", "value3");

    Enumeration e = table.keys();
    while (e.hasMoreElements()) {
        String key = (String) e.nextElement();
        System.out.println(key + " : " + table.get(key));
    }/*from   ww  w  . j  av  a 2s .  c  o  m*/
}

From source file:Main.java

public static void main(String[] args) {
    Hashtable<String, String> ht = new Hashtable<String, String>();

    ht.put("1", "One");
    ht.put("2", "Two");
    ht.put("3", "Three");

    Enumeration e = ht.keys();

    while (e.hasMoreElements()) {
        System.out.println(e.nextElement());
    }/*from  w w w  .  j a  v a2s  .  co m*/
}

From source file:Main.java

public static void main(String[] args) {
    Hashtable<String, String> ht = new Hashtable<String, String>();

    ht.put("1", "One");
    ht.put("2", "Two");
    ht.put("3", "Three");

    Enumeration e = ht.elements();

    while (e.hasMoreElements()) {
        System.out.println(e.nextElement());
    }/*  www . j a  v  a  2s.  c om*/
}