Friday, 15 June 2012

Eclipse Is Great

Eclipse is a great Java IDE that must be celebrated. Among the cool features:

1. Automatic strikethough of class names where the class is deprecated

Hacking apache collections

Once you get the jar added to your project, you can start cruising the javadoc and seeing what you can make of the Apache collections classes (and interfaces, mind you).

This will take you a few steps beyond the humble plateau of plain-vanilla Maps and Lists, by introducing variations of Sets and different types of Maps, designed for special scenarios. But before you ascend to the Java data structure stratosphere, you might want to recap your knowledge on the basic interfaces in the Collections framework, such as the Map interface, and the List interface. An interesting point of comparison, is that while the Map interface has no superinterfaces, the List interface is superinterface'd by the Collection interface and the Iterable interface by extension, since Collections are by necessity Iterable.

Perhaps, you are interested in the numerous implementations of Bags (sets that allow repeat elements e.g. two pairs of socks in a gym bag), and wander over to TreeBag or HashBag (now deprecated). Also fascinating are the various implementations of the BidiMap interface such as TreeBidiMap, that allows lookup from keys to values and values to keys- with equal efficiency. It is more storage efficient than using two separate TreeMaps, although the DualTreeBidiMap does use this approach.

Remember always the distinction between interfaces and classes, do not try to create an object of type Bag by instantiating Bag, but rather create an instance of TreeBag (but not HashBag) i.e. instantiate the implementing classes (but not deprecated ones!)

Wednesday, 29 February 2012

The Road of JSR (Java Specification Request)

Unhappy with Java APIs as they stand? File a JSR (Java Specification Request). An example would be the Money and Currency API (JSR 354). Filing JSRs is part of the Java Community Process.

Sunday, 2 October 2011

Java Service Wrapper

The JSW is from Tokyo-based Tanuki Software, which allows you to run Java applications as Windows Services.

Saturday, 18 June 2011

Friday, 17 June 2011

FT Video uses Apache Tomcat v6.0

Tomcat implements Java Servlet and Java Server Pages technologies. One word you'll hear in connection with Tomcat is AJP (Apache JServ Protocol), a packet-oriented binary protocol. AJP is also used in the Jetty servlet container.

javax.servlet.ServletException: java.lang.ArrayStoreException

It also uses ehcache from Terracotta.

Saturday, 20 February 2010

Java now under the Banner of the Oracle Technology Network

Feb 2010 and Oracle's takeover of Sun Microsystems is complete. All Java webpages are now under the banner of the Oracle Technology Network. Is this the end of Java?