Programming Problem – The City of Archers

Here’s an interesting programming problem that a friend of mine sent me a few days back. Download a working Java solution for this problem here. The City Of Archers Back in human history there used to exist a city known as Genon City .It was always under threat from the enemies but it had the best archers in the world ever known to protect it. To prepare for battle all archers performed similar actions....

January 20, 2011

onclick or ONCLICK or onClick?

XHTML mandates lowercase event handler names.

March 25, 2010

Using StringReader to iterate over a String

Iterate over a String character by character.

March 12, 2010

Creating singleton collections

Collections class provides static methods for immutable singleton collections (List, Map, Set).

March 4, 2010

Creating unmodifiable & synchronized collections

By default, the classes available in the Java Collections framework are read/write enabled & not thread safe. Sometimes the requirement is to have a read only i.e. unmodifiable collection. The Collections class available in the java.util package provides utility methods to create such collections. Note: Do not confuse this class with the Collection interface which is the root interface of the collection hierarchy. The objects returned by these methods are wrappers over the original collection object you supply to the method (Decorator design pattern)....

March 2, 2010