db4o 6.1

com.db4o.types
Interface Db4oCollections


public interface Db4oCollections

factory and other methods for database-aware collections.


Method Summary
 Db4oMap newHashMap(int initialSize)
          creates a new database-aware HashMap.
 Db4oMap newIdentityHashMap(int initialSize)
          creates a new database-aware IdentityHashMap.
 Db4oList newLinkedList()
          creates a new database-aware linked list.
 

Method Detail

newLinkedList

Db4oList newLinkedList()
creates a new database-aware linked list.

Usage:
- declare a java.util.List variable in your persistent class.
- fill this variable with this method.

Example:

 class MyClass{
     List myList;
 }
 
 MyClass myObject = new MyClass(); 
 myObject.myList = objectContainer.ext().collections().newLinkedList();


Returns:
Db4oList
See Also:
Db4oList

newHashMap

Db4oMap newHashMap(int initialSize)
creates a new database-aware HashMap.

This map will call the hashCode() method on the key objects to calculate the hash value. Since the hash value is stored to the ObjectContainer, key objects will have to return the same hashCode() value in every VM session.

Usage:
- declare a java.util.Map variable in your persistent class.
- fill the variable with this method.

Example:

 class MyClass{
     Map myMap;
 } 
 
 MyClass myObject = new MyClass(); 
 myObject.myMap = objectContainer.ext().collections().newHashMap(0);


Parameters:
initialSize - the initial size of the HashMap
Returns:
Db4oMap
See Also:
Db4oMap

newIdentityHashMap

Db4oMap newIdentityHashMap(int initialSize)
creates a new database-aware IdentityHashMap.

Only first class objects already stored to the ObjectContainer (Objects with a db4o ID) can be used as keys for this type of Map. The internal db4o ID will be used as the hash value.

Usage:
- declare a java.util.Map variable in your persistent class.
- fill the variable with this method.

Example:

 class MyClass{
     Map myMap;
 }
 
 MyClass myObject = new MyClass(); 
 myObject.myMap = objectContainer.ext().collections().newIdentityMap(0);


Parameters:
initialSize - the initial size of the HashMap
Returns:
Db4oMap
See Also:
Db4oMap

db4o 6.1