Package org.mapdb.elsa
Class ElsaStack.IdentityArray
java.lang.Object
org.mapdb.elsa.ElsaStack
org.mapdb.elsa.ElsaStack.IdentityArray
- Enclosing class:
ElsaStack
uses array with linear identity (==) search. Uses little memory, but performance degrades fast with number of objects on stack
-
Nested Class Summary
Nested classes/interfaces inherited from class org.mapdb.elsa.ElsaStack
ElsaStack.IdentityArray, ElsaStack.MapStack, ElsaStack.NoReferenceStack -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidgetInstance(int i) intgetSize()intidentityIndexOf(Object obj) This method is reason why ArrayList is not used.Methods inherited from class org.mapdb.elsa.ElsaStack
addClassInfo, resolveClassId, resolveClassInfo
-
Field Details
-
size
private int size -
data
-
forwardRefs
public boolean forwardRefs
-
-
Constructor Details
-
IdentityArray
public IdentityArray()
-
-
Method Details
-
add
-
identityIndexOf
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.- Specified by:
identityIndexOfin classElsaStack- Parameters:
obj- to find in list- Returns:
- index of object in list or -1 if not found
-
getSize
public int getSize() -
getInstance
- Specified by:
getInstancein classElsaStack
-