Methods Summary |
---|
public static void | forLong()A wordy for loop.
Properties props = System.getProperties();
Iterator iter = props.keySet()
.iterator();
String key = null;
while (iter.hasNext()) {
key = key = (String)iter.next();
System.out.println(key + "=" + System.getProperty(key));
}
|
public static void | forSafe()A completely safe and short for loop.
Properties props = System.getProperties();
Iterator iter = props.keySet()
.iterator();
for (String key = null; iter.hasNext(); key = (String)iter.next()) {
System.out.println(key + "=" + System.getProperty(key));
}
|
public static void | forShort()A short for loop.
Properties props = System.getProperties();
for (Iterator iter = props.keySet()
.iterator(); iter.hasNext();) {
String key = (String)iter.next();
System.out.println(key + "=" + System.getProperty(key));
}
|
public static void | forSimple(java.lang.String[] args)A simple for loop.
for (int idx = 0; idx < args.length; idx++) {
// .. do something.
}
|
public static void | forWeird()A weird for loop.
boolean exit = false;
int idx = 0;
for (System.setProperty("user.sanity", "minimal"); exit == false;
System.out.println(System.currentTimeMillis())) {
// do some code.
idx++;
if (idx == 10) {
exit = true;
}
}
|
public static void | main(java.lang.String[] args)Demo method.
forWeird();
|
public static void | propsDump(java.util.Set customKeys)A for loop bug.
Properties props = System.getProperties();
Iterator iter = props.keySet()
.iterator();
String key = null;
System.out.println("All Properties:");
while (iter.hasNext()) {
key = (String)iter.next();
System.out.println(key + "=" + System.getProperty(key));
}
System.out.println("Custom Properties:");
iter = customKeys.iterator();
while (iter.hasNext()) {
System.out.println(key + "=" + System.getProperty(key));
}
|