Multiple instances.

This is the first of the advanced tutorials, and from this point on I will asume that you know a bit about how maps work. Chronus is a map, and therefore has the same interface as hashmaps and hashtables.

Previously we have only worked with the global database, by constructing chronus without any parameters. In this tutorial we show how to specify our own databases.

In the following example we create two databases, insert a key-value pair into each and copy the data from one database to the other.

Chronus db1 = new Chronus("database1"); //create database one
Chronus db2 = new Chronus("database2"); //create database two
db1.put("key1", "some data"); //insert data into db1
db2.put("key2", "some data"); //insert data into db2
db2.putAll(db1); //insert all the data from db1 into db2

That is all there is to it, simple, isnt it?

Now I'll show you how to combine normal(non-persistant) maps with chronus.

In the following example we create a hashtable, fill it with some values and copy all its data into our database.

Chronus db = new Chronus(); //create database
Chronus ht = new Hashtable();
ht .put("key1", "some data"); //insert data into the hashtable
ht .put("key2", "some data");
db2.putAll(ht); //insert all the data from the hashtable into db1