Thursday 14 June 2007

Code completion and a lazy developer

(Integer) Integer.getInteger("12345")

Wow, that a nice stupid code. I lost 1 hour because of it. Thanks to YOU! The static Integer.getInteger(String) method return the value of a SYSTEM, I repeat a SYSTEM, property as an Integer. Hey! Lazy developers, read the javadoc before code completion.

Use this instead:

(Integer)
Integer.valueOf(String)


or

(int) Integer.parseInt(String)

No comments: