KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > collections > MapUsage


1 // You can redistribute this software and/or modify it under the terms of
2
// the Ozone Library License version 1 published by ozone-db.org.
3
//
4
// This file is
5
// Copyright (C) 2003-@year@ Per Nyfelt. All rights reserved.
6
// $Id: $
7
//
8
package collections;
9
10 import org.ozoneDB.collections.NodeTreeMapImplFactory;
11
12 import java.util.Map JavaDoc;
13
14 /**
15  * @author Per Nyfelt
16  */

17 public class MapUsage {
18     public static void main(String JavaDoc[] args) throws Exception JavaDoc {
19         NodeTreeMapImplFactory.setDefaultDatabaseUrl("ozonedb:remote://localhost:3333");
20         Map JavaDoc map = NodeTreeMapImplFactory.getDefault().create();
21
22         map.put("key1", "value1");
23         map.put("key2", "value2");
24         System.out.println("key1 has value " + map.get("key1"));
25
26         NodeTreeMapImplFactory.getDefault().closeDatabase();
27         // another way is to set the db url to null
28
//NodeTreeMapImplFactory.setDefaultDatabaseUrl(null);
29
}
30 }
31
Popular Tags