ClustrMaps

The roadrunner is back as never before! See also: My homepage or my very obsolete site
If by any means entries in my blog are considered to be harmful or damaging, please let me know (add comment) or just mail me. In this (unhopely) case I will remove or change the contents.

Wednesday, March 04, 2009

Java demystified


See this simple example:
ArrayList list = new ArrayList();
String s;
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
s = (String) iterator.next();
System.out.println(s);
}

Having a nice while block.

Now look at the decompiled bytecode:

ArrayList list = new ArrayList();
String s;
for(Iterator iterator = list.iterator(); iterator.hasNext(); System.out.println(s))
s = (String)iterator.next();

The while block is transformed into a for loop.

The myth is: do not use for but while.
The myth is: declare variables outside the loop.
As the compiler sees that the variable is only used inside the loop, it will place the declaration inside the loop.

Tell me lies, sweet little lies...

See in this context:
http://www.amazon.com/Java-Demystified/dp/B0012OYBX0

Never ever heard of this device: a kindle, see:
http://en.wikipedia.org/wiki/Amazon_Kindle

A specific e-Book reader, using electronic paper!
What is the added value of color?

No comments: