technology

Java 5 pitfall

Java 5 has some nice improvements over Java 1.4 that really make writing code simpler… Then again sometimes simpler also means dangerous. Case in point, Java 5 auto-boxing. Consider the following method:

public Boolean isValid()
{
  // if we don't have any data, we cannot decide so we return null,
  // which is why we're using Boolean instead of boolean
  if(data == null)
  {
    return null;
  }
  else
  {
    // data.isValid() returns a Boolean
    return data.isValid();
  }
}

As you can see, we are using Boolean as a return type to provide a ternary result instead of a simple true/false decision: sometimes, More >

Kaneda’s bike?

It was the end of the 80’s and as a dorky teenager, I was fascinated by Katsuhiro Otomo’s Akira, and in particular, its main character’s bike. This childhood’s dream of a bike seems eerily close today with the EV-X7 prototype electric bike. Looks like I won’t have to wait until 2019 after all!

Treehugger