Example usage for java.util Iterator next

List of usage examples for java.util Iterator next

Introduction

In this page you can find the example usage for java.util Iterator next.

Prototype

E next();

Source Link

Document

Returns the next element in the iteration.

Usage

From source file:MainClass.java

public static void main(String[] args) {
    Map charSets = Charset.availableCharsets();
    Iterator it = charSets.keySet().iterator();
    while (it.hasNext()) {
        String csName = (String) it.next();
        System.out.print(csName);
        Iterator aliases = ((Charset) charSets.get(csName)).aliases().iterator();
        if (aliases.hasNext())
            System.out.print(": ");
        while (aliases.hasNext()) {
            System.out.print(aliases.next());
            if (aliases.hasNext())
                System.out.print(", ");
        }// w w  w  . ja  va 2 s  .  c  o  m
        System.out.println();
    }
}

From source file:Main.java

public static void main(String[] args) {
    Map<String, Charset> charsets = Charset.availableCharsets();
    Iterator<Charset> iterator = charsets.values().iterator();
    while (iterator.hasNext()) {
        Charset cs = (Charset) iterator.next();
        System.out.println(cs.aliases());
    }//from   w  w  w.j  a  v a  2s .  c o m
}

From source file:Main.java

public static void main(String[] args) {
    Map<String, Charset> charsets = Charset.availableCharsets();
    Iterator<Charset> iterator = charsets.values().iterator();
    while (iterator.hasNext()) {
        Charset cs = (Charset) iterator.next();
        System.out.print(cs.displayName());
    }/*  ww  w  . j a  va 2s .co m*/
}

From source file:MainClass.java

public static void main(String[] args) throws Exception {
    CertificateFactory cf = CertificateFactory.getInstance("X.509");
    FileInputStream in = new FileInputStream(args[0]);
    X509CRL crl = (X509CRL) cf.generateCRL(in);
    Set s = crl.getRevokedCertificates();
    if (s != null && s.isEmpty() == false) {
        Iterator t = s.iterator();
        while (t.hasNext()) {
            X509CRLEntry entry = (X509CRLEntry) t.next();
            System.out.println("serial number = " + entry.getSerialNumber().toString(16));
            System.out.println("revocation date = " + entry.getRevocationDate());
            System.out.println("extensions = " + entry.hasExtensions());
        }/*w  ww .  j a  v  a2s. com*/
    }
    in.close();
}

From source file:PreferencesDemo.java

public static void main(String[] args) throws Exception {
    Preferences prefs = Preferences.userNodeForPackage(PreferencesDemo.class);
    prefs.put("Location", "Oz");
    prefs.put("Footwear", "Ruby Slippers");
    prefs.putInt("Companions", 4);
    prefs.putBoolean("Are there witches?", true);
    int usageCount = prefs.getInt("UsageCount", 0);
    usageCount++;//from w w w .  j  a  v a 2 s  . co m
    prefs.putInt("UsageCount", usageCount);
    Iterator it = Arrays.asList(prefs.keys()).iterator();
    while (it.hasNext()) {
        String key = it.next().toString();
        System.out.println(key + ": " + prefs.get(key, null));
    }
    // You must always provide a default value:
    System.out.println("How many companions does Dorothy have? " + prefs.getInt("Companions", 0));
}

From source file:Main.java

public static void main(String[] args) {
    Map<String, Charset> charsets = Charset.availableCharsets();
    Iterator<Charset> iterator = charsets.values().iterator();
    while (iterator.hasNext()) {
        Charset cs = (Charset) iterator.next();
        System.out.print(cs.displayName(Locale.getDefault()));
    }/*  w  w  w . j  a  v  a 2  s  .co  m*/
}

From source file:Main.java

static public void main(String args[]) throws Exception {
    int width = 200, height = 200;
    BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);

    Graphics2D ig2 = bi.createGraphics();
    ig2.fillRect(0, 0, width - 1, height - 1);

    Iterator imageWriters = ImageIO.getImageWritersByFormatName("GIF");
    ImageWriter imageWriter = (ImageWriter) imageWriters.next();
    File file = new File("filename.gif");
    ImageOutputStream ios = ImageIO.createImageOutputStream(file);
    imageWriter.setOutput(ios);/*w  w  w . j a  v a2s  . co  m*/
    imageWriter.write(bi);
}

From source file:EnumerationIterator1.java

public static void main(String args[]) {
    String elements[] = { "Java", "Source", "and", "Support", "." };
    Vector v = new Vector(Arrays.asList(elements));
    Enumeration e = v.elements();
    Iterator itor = EnumerationIterator1.iterator(e);
    while (itor.hasNext()) {
        System.out.println(itor.next());
    }/*from   w ww .j  a  va2 s  .  c o  m*/
}

From source file:Main.java

public static void main(String[] args) throws IOException {
    String fileContent = "s1=1\n" + "s2=Main\n" + "s3=Fri Jan 31 00:00:00 IST 3913";
    StringReader reader = new StringReader(fileContent);

    PropertyResourceBundle bundle = new Main(reader);

    Set keySet = bundle.handleKeySet();
    Iterator keys = keySet.iterator();
    while (keys.hasNext()) {
        System.out.println("Bundle key: " + keys.next());
    }// w  w  w .  j  a  va 2  s .  c om

}

From source file:Main.java

public static void main(String[] args) {
    Map<String, Charset> charsets = Charset.availableCharsets();
    Iterator<Charset> iterator = charsets.values().iterator();
    while (iterator.hasNext()) {
        Charset cs = (Charset) iterator.next();
        System.out.println(cs.displayName());
        System.out.println(cs.hashCode());
    }/*from  ww w  .j  a va 2 s  . co  m*/
}