net.esper.collection
Class IndexedDataCollection

java.lang.Object
  extended by net.esper.collection.IndexedDataCollection

public final class IndexedDataCollection
extends java.lang.Object

Collection to hold indexed data. Each key maps to multiple values. Objects can be added to keys. The key class should override the equals and hashCode methods. Same value objects can be added twice to the collection - the collection does not enforce set behavior.


Constructor Summary
IndexedDataCollection()
           
 
Method Summary
 void add(java.lang.Object key, java.lang.Object bean)
          Add a value object to the index.
 java.util.List<java.lang.Object> get(java.lang.Object key)
          Returns a list of value objects for the given key, or null if there are no value objects for this key.
 boolean remove(java.lang.Object key, java.lang.Object bean)
          Removes a value object from the index, returning a boolean value to indicate if the value object was found.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexedDataCollection

public IndexedDataCollection()
Method Detail

add

public final void add(java.lang.Object key,
                      java.lang.Object bean)
Add a value object to the index. If the value object already exists for the same key, no error is thrown and the object is still added (no set behavior).

Parameters:
key - is the key value
bean - is the value object to add

remove

public final boolean remove(java.lang.Object key,
                            java.lang.Object bean)
Removes a value object from the index, returning a boolean value to indicate if the value object was found.

Parameters:
key - is the key value
bean - is the value object to remove
Returns:
true if the value object was successfully removed, false if the key or value object could not be found

get

public final java.util.List<java.lang.Object> get(java.lang.Object key)
Returns a list of value objects for the given key, or null if there are no value objects for this key.

Parameters:
key - is the index key value
Returns:
null if key has no associated value objects, or the list of value objects for the key