StockQuoteTransformer sqTransformer = new StockQuoteTransformer();
sqTransformer.setQuoteURL( new URL("http://quotes.company.com") );
sqTransformer.setTimeout( 500 );
stockQuotes = new LRUMap( 5 );
stockQuotes = LazyMap.decorate( stockQuotes, sqTransformer );
// Now use some of the entries in the cache
Float cscoPrice = (Float) stockQuotes.get( "CSCO" );
Float msPrice = (Float) stockQuotes.get( "MSFT" );
Float tscPrice = (Float) stockQuotes.get( "TSC" );
Float luPrice = (Float) stockQuotes.get( "LU" );
Float pPrice = (Float) stockQuotes.get( "P" );
Float msPrice2 = (Float) stockQuotes.get( "MSFT" );
// Add another price to the Map, this should kick out the LRU item.
stockQuotes.put( "AA", new Float( 203.20 ) );
// CSCO was the first price requested, it is therefor the
// least recently used.
if( !stockQuotes.containsKey("CSCO") ) {
System.out.println( "As expected CSCO was discarded" );
}