Friday, 29 August 2014

Building Real Software: Don’t waste time on Code Reviews

Article on Code Reviews that explains how to get the most out of code reviews, without waisting time.

Building Real Software: Don’t waste time on Code Reviews: Less than half of development teams do code reviews and the other half are probably not getting as much out of code reviews as they should...

Friday, 15 August 2014

Java Enum values() method

I remember there being a values() method that provides all possible values of an Enumerated Type in Java. I checked the javadoc1 and couldn't find it...

But it exists.

Which is weird.

Luckily, someone else had the same problem and asked it in [2].

I was intriged so I looked up the Language Spec3. Yes, the method is available in each and every Enum class, but it is 'especially' inserted by the compiler and not inherited from the superclass4.

Luckily in the javadoc1, values() and valueOf(String) methods are both mentioned in the description of the valueOf(Class<T> , String) method (nowadays).

References

[1] Javadoc - Enum
http://docs.oracle.com/javase/8/docs/api/java/lang/Enum.html
[2] CodeRanch - Values method documented Enum
http://www.coderanch.com/t/559674/java/java/values-method-documented-Enum
[3] Oracle - The Java Language Specification (Java 8)
http://docs.oracle.com/javase/specs/jls/se8/jls8.pdf
[4] Oracle Java Tutorials - Enum Types
http://docs.oracle.com/javase/tutorial/java/javaOO/enum.html