org.pentaho.di.core.util
Class KeyValueSet

java.lang.Object
  extended by org.pentaho.di.core.util.KeyValueSet
All Implemented Interfaces:
Serializable, Iterable<KeyValue<?>>

public class KeyValueSet
extends Object
implements Iterable<KeyValue<?>>, Serializable

Author:
Thomas Hoedl(asc042)
See Also:
Serialized Form

Constructor Summary
KeyValueSet()
           
 
Method Summary
 KeyValueSet add(KeyValue<?>... keyValues)
          Add key value(s).
 KeyValueSet clear()
          Clear entries.
 boolean containsKey(String key)
           
 List<KeyValue<?>> get(org.apache.commons.collections.Predicate filter)
           
 KeyValue<?> get(String key)
           
 KeyValue<?> getRequired(String key)
           
 boolean isEmpty()
           
 Iterator<KeyValue<?>> iterator()
          
 List<String> keys()
           
 List<KeyValue<?>> keyValues()
           
 KeyValue<?> remove(String key)
           
 int size()
           
 Map<String,Object> toMap()
           
 String toMultiLineString()
           
 String toString()
          
 List<Object> values()
           
 void walk(org.apache.commons.collections.Closure handler)
          Walk entries.
 void walk(org.apache.commons.collections.Closure handler, org.apache.commons.collections.Predicate filter)
          Walk entries.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyValueSet

public KeyValueSet()
Method Detail

add

public KeyValueSet add(KeyValue<?>... keyValues)
Add key value(s).

Parameters:
keyValues - key values to add.
Returns:
this.

iterator

public Iterator<KeyValue<?>> iterator()

Specified by:
iterator in interface Iterable<KeyValue<?>>
See Also:
Iterable.iterator()

get

public KeyValue<?> get(String key)
Parameters:
key - the key.
Returns:
key value or null.

get

public List<KeyValue<?>> get(org.apache.commons.collections.Predicate filter)
                      throws IllegalArgumentException
Parameters:
filter - filter to use.
Returns:
matching key values.
Throws:
IllegalArgumentException - if filter is null.

getRequired

public KeyValue<?> getRequired(String key)
Parameters:
key - the key.
Returns:
key value, never null.

keys

public List<String> keys()
Returns:
keys.

keyValues

public List<KeyValue<?>> keyValues()
Returns:
key values/entries.

values

public List<Object> values()
Returns:
values.

toMap

public Map<String,Object> toMap()
Returns:
entries as map.

walk

public void walk(org.apache.commons.collections.Closure handler,
                 org.apache.commons.collections.Predicate filter)
          throws IllegalArgumentException
Walk entries.

Parameters:
handler - handler to call.
filter - filter to use.
Throws:
IllegalArgumentException - if closure or filter is null.

walk

public void walk(org.apache.commons.collections.Closure handler)
          throws IllegalArgumentException
Walk entries.

Parameters:
handler - handler to call.
Throws:
IllegalArgumentException - if handler is null.

remove

public KeyValue<?> remove(String key)
Parameters:
key - the key.
Returns:
previous or null.

containsKey

public boolean containsKey(String key)
Parameters:
key - key to test.
Returns:
true if ...

size

public int size()
Returns:
size.

isEmpty

public boolean isEmpty()
Returns:
true if empty.

clear

public KeyValueSet clear()
Clear entries.

Returns:
this.

toMultiLineString

public String toMultiLineString()
Returns:
string representation.

toString

public String toString()

Overrides:
toString in class Object
See Also:
Object.toString()