Platform SDK Java 8.5 API Reference

com.genesyslab.platform.commons.collections
Interface KVList.PairList

All Superinterfaces:
java.lang.Cloneable
Enclosing class:
KVList

public static interface KVList.PairList
extends java.lang.Cloneable

A list of key-value pairs. Used as an abstraction of pairs storage. Usage of this list for other purposes is not expected. There are no public implementation of this interface, so if you are going to subclass KVList or its subclasses you will have to create own implementation.


Method Summary
 void add(Pair pair)
          Adds pair to the storage.
 boolean addAfter(Pair pair, Pair where)
          Adds pair just after another pair.
 boolean addBefore(Pair pair, Pair where)
          Adds pair just before another pair.
 java.util.Collection asCollection()
          Returns this list as a collection of Pairs.
 void clear()
          Clears the storage.
 java.lang.Object clone()
          Clones the storage.
 Pair findPair(java.lang.Object key)
          Finds pair in the storage by key.
 Pair get(int index)
          Gets pair from the storage by index.
 java.util.Enumeration getEnumeration()
          Returns an Enumeration through the storage.
 java.util.Enumeration getPairEnumeration(java.lang.Object key)
          Returns an Enumeration of pairs with specified key.
 void insert(Pair pair, int index)
          Inserts pair to the storage at specified index.
 boolean isEmpty()
          Checks if the storage is empty (doesn't contain any pair).
 int length()
          Returns the number of elements in this storage.
 Pair remove(int index)
          Removes pair from the storage by index.
 Pair remove(java.lang.Object key)
          Removes pair from the storage by key.
 

Method Detail

add

void add(Pair pair)
Adds pair to the storage.

Parameters:
pair - Pair to add

findPair

Pair findPair(java.lang.Object key)
Finds pair in the storage by key.

Parameters:
key - Key of the pair to find
Returns:
First pair with specified key or null if pair is not found.

remove

Pair remove(java.lang.Object key)
Removes pair from the storage by key.

Parameters:
key - Key of the pair to remove
Returns:
Removed pair or null if pair is not found.

remove

Pair remove(int index)
Removes pair from the storage by index. Warning: This method can be inefficient (implementation not required to support access by index)

Parameters:
index - Index of the pair to remove
Returns:
Removed pair or null if pair is not found.

clear

void clear()
Clears the storage.


clone

java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clones the storage. The storage returned should be completely independent of this storage. In other words changing this storage shouldn't affect the clone in any way and vise versa.

Returns:
Clone of this storage.
Throws:
java.lang.CloneNotSupportedException - if this storage can't be cloned

getEnumeration

java.util.Enumeration getEnumeration()
Returns an Enumeration through the storage. Type of elements in this storage depends on list implementation.

Returns:
Enumeration for the storage

getPairEnumeration

java.util.Enumeration getPairEnumeration(java.lang.Object key)
Returns an Enumeration of pairs with specified key. Type of elements in this storage depends on list implementation.

Returns:
Enumeration for the storage

addAfter

boolean addAfter(Pair pair,
                 Pair where)
Adds pair just after another pair.

Parameters:
pair - Pair to add
where - Pair to add after
Returns:
true if pair is added, false otherwise

addBefore

boolean addBefore(Pair pair,
                  Pair where)
Adds pair just before another pair.

Parameters:
pair - Pair to add
where - Pair to add before
Returns:
true if pair is added, false otherwise

length

int length()
Returns the number of elements in this storage.

Returns:
the number of elements in the storage

isEmpty

boolean isEmpty()
Checks if the storage is empty (doesn't contain any pair).

Returns:
true - if storage is empty and false otherwise

insert

void insert(Pair pair,
            int index)
Inserts pair to the storage at specified index. Warning: This method can be inefficient (implementation is not required to support access by index)

Parameters:
pair - Pair to insert
index - The position to insert pair at.

get

Pair get(int index)
Gets pair from the storage by index. Warning: This method can be inefficient (implementation is not required to support access by index)

Parameters:
index - The position to insert pair at.

asCollection

java.util.Collection asCollection()
Returns this list as a collection of Pairs.

Returns:
Collection of Pairs

Platform SDK Java 8.5 API Reference

Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.