Sign in to follow this  
tufflax

[java] while (...) Object o = it.next() or Object o while (...) o = it.next()

Recommended Posts

Hey! I was just wondering if there is any difference in speed if one does, for example:
Iterator it = list.iterator();
while (it.hasNext()) {
    Object o = it.next();
}
compared to
Iterator it = list.iterator();
Object o;
while (it.hasNext()) {
    o = it.next();
}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this