This example only works with ObjectSpace Voyager(tm).
Visit the Voyager homepage for more information.
try
{
// create a remote map that allows duplicate keys
VHashMap map = new VHashMap( true, "localhost:8000" );
// fill remote map
map.add( "city", "Austin" );
map.add( "song", "Texas Fight!" );
map.add( "mascot", "Bevo" );
map.add( "mascot", "Longhorns" );
System.out.println( "map = " + map ); // prints locally
// query remote container
System.out.println( "map.size() = " + map.size() );
System.out.println( "map.empty() = " + map.isEmpty() );
System.out.println( "map.get( \"song\" ) = " + map.get( "song" ) );
// mutate remote container
map.clear();
System.out.println( "\nafter remote map is cleared..." );
System.out.println( "map.size() = " + map.size() );
System.out.println( "map.empty() = " + map.isEmpty() );
System.out.println( "map.get( \"song\" ) = " + map.get( "song" ) );
}
catch ( VoyagerException ex )
{
System.err.println( "caught: " + ex );
}
Voyager.shutdown();