Isn’t it about time we got to know the different stream classes a bit better? We use them in almost every project, but what do they mean? How should can we use them more efficiently? And what is the difference between a Reader and an InputStream anyway? I hope I’ll manage to give the answers I’ve come across from using, implementing and reviewing other implementations of these extremely useful classes. Continue reading »
In my project, Xml2Java, I had need for a code that checks reflection information, specifically methods and fields, and operates on relevant ones. For example, I wanted the code that analyses the elements and attributes of a complex element to work only on getter methods, that is, methods that begin with “get” or “is” and return a boolean.
At first, the code looked like this:
for (Method method : clazz.getMethods()) {
if (method.getName().startsWith("get") ||
(method.getName().startsWith("is") &&
method.getReturnType().equals(Boolean.TYPE))) {
// do stuff
}
}
Whirling around Java
About a month ago Roman Strobl mentioned the Whirl programming language on his blog, along with some other eccentric programming languages by the same author, Sean.
Whirl is an odd programming language, reminding me a mutation of the accursed Enigma machine. It uses two wheel of 12 operation each, which the language’s operators rotate and execute. The language’s operators are only 1′s and 0′s. The language also allows for two registers and an infinite, non-RAM of memory.
Because of this, executing a command, reading an input or making a calculation changes the entire state of the Whirl machine, making even concurrent executions of the same operation different as the machine state changes with them.
Liked Chaotic Java? It's free! But maybe you can