Reverse Words - GCJ 2010 (Africa)

Below is a problem statement from the 'Google African Code Jam' (which is happening, at the moment):Problem-------Given a list of space separated words, reverse the order of the words. Each line of text contains L letters and W words. A line will only...

» [Read More]

Google Guice - Example

Dependency Injection and Google's Guice framework need no introduction from me, as the documentation on Google's project hosting site is pretty good. Also, there are loads of articles and other information related to these topics, on the internet. So, I will start off with a pretty basic java...

» [Read More]

Guice Grapher - Example

Guice provides a 'Grapher' module, as an extension to its framework, to visualize the bindings and the application structure. This module is not yet available in the guice-2.0 version (and is not packed in any of the jar files of this version), but you can download the source code from...

» [Read More]

Using Richfaces 'Suggestion Box' As Combo Box

If you had already tried to use Richfaces Combo Box for populating the 'id-value' pairs, you would have noticed that the dropdown/combo box will be populated with id's, rather than values. It's not a bug or a problem with richfaces framework, but a different design. There's a workaround for this,...

» [Read More]

Hashcode Of A String In Java

Many of the Java programmers know what 'Hashcode' means, but don't really know how exactly it is calculated and why 31 is used to calculate the hashcode. Below is the code snippet from Java 1.6, which calculates the hashcode for a string:public int hashCode() {int h...

» [Read More]