Sam ([info]l33tminion) wrote,
@ 2008-04-08 21:23:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
Current mood: blah
Current music:Coheed & Cambria - God Send Conspirator
Entry tags:class, programming

Cancer of the Semicolon
The following is only relevant to the programmers on my friends list, probably...

So, did you know that Java has syntactic sugar for iterating over a collection? So you can write this:

for (SomeType item: stuff) {
    // code here
}
Instead of:
for (Iterator<SomeType> iter = stuff.iterator(); iterator.hasNext();) {
    SomeType item = iter.next()
    // code here
}
I didn't until recently. When did that happen? Was that not around when I was first learning Java?

Despite that, I'm feeling more competent Java-wise lately. I feel that I finally understand the JNI (how to use it, anyways). I even got a C++ API for the multitouch hardware I'm using to play nicely with some Java code.


(Post a new comment)


[info]kihou
2008-04-09 01:43 am UTC (link)
That got added in Java 5, so after the AP test, at least. Don't know how much Java you've done since then.

(Reply to this)(Thread)


[info]l33tminion
2008-04-09 01:45 am UTC (link)
I seem to do bits here and there most jobs I'm on, but I hadn't seen that idiom in any of the code I worked with.

(Reply to this)(Parent)


Create an Account
Forgot your login?
Login w/ OpenID
English • Español • Deutsch • Русский…