org.mapdb
Class SerializerBase.FastArrayList<K>

java.lang.Object
  extended by org.mapdb.SerializerBase.FastArrayList<K>
Enclosing class:
SerializerBase

protected static final class SerializerBase.FastArrayList<K>
extends Object

Utility class similar to ArrayList, but with fast identity search.


Field Summary
 K[] data
           
 boolean forwardRefs
           
 int size
           
 
Constructor Summary
SerializerBase.FastArrayList()
           
 
Method Summary
 void add(K o)
           
 int identityIndexOf(Object obj)
          This method is reason why ArrayList is not used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

size

public int size

data

public K[] data

forwardRefs

public boolean forwardRefs
Constructor Detail

SerializerBase.FastArrayList

public SerializerBase.FastArrayList()
Method Detail

add

public void add(K o)

identityIndexOf

public int identityIndexOf(Object obj)
This method is reason why ArrayList is not used. Search an item in list and returns its index. It uses identity rather than 'equalsTo' One could argue that TreeMap should be used instead, but we do not expect large object trees. This search is VERY FAST compared to Maps, it does not allocate new instances or uses method calls.

Parameters:
obj - to find in list
Returns:
index of object in list or -1 if not found


Copyright © 2014. All Rights Reserved.