com.spire.doc.collections
Class TypedSortedListEx<TKey extends java.util.Comparator,TValue>

java.lang.Object
  extended by com.spire.doc.collections.TypedSortedListEx<TKey,TValue>
Direct Known Subclasses:
SortedDictionary, SortedItemList

public class TypedSortedListEx<TKey extends java.util.Comparator,TValue>
extends java.lang.Object


Constructor Summary
TypedSortedListEx()
          Default constructor.
TypedSortedListEx(java.util.Comparator comparer)
          Creates an empty SortedList with the default initial capacity and specified comparer.
TypedSortedListEx(java.util.Comparator comparer, int capacity)
          Creates an empty SortedList with the specified initial capacity and specified comparer.
TypedSortedListEx(int initialCapacity)
          Creates an empty list with the specified initial capacity.
 
Method Summary
 void add(TKey key, TValue value)
          Adds an element with the provided key and value to the list.
 void clear()
          Removes all elements from the collection.
 TypedSortedListEx cloneAll()
          Clone current instance.
 boolean contains(TKey key)
          Determines whether the list contains an element with the specified key.
 boolean containsKey(TKey key)
          Determines whether the list contains an element with the specified key.
 boolean containsValue(TValue value)
          Determines whether the list contains the specified value.
 void copyTo(com.spire.ms.System.Array array, int arrayIndex)
          Copies all the elements of the SortedListEx to the specified one-dimensional Array starting at the specified destination Array index.
 java.lang.Object deepClone()
          Creates a new object that is a copy of the current instance.
 TValue get(TKey key)
          Gets the value associated with the specified key.
 TValue getByIndex(int index)
          Gets the value at the specified index of the SortedListEx.
 int getCapacity()
          Capacity of internal buffers
 int getCount()
          FontSize of the collection.
 TKey getKey(int index)
          Gets the key at the specified index of the SortedListEx.
 com.spire.ms.System.Collections.IList getKeyList()
          Gets the keys in the SortedListEx.
 com.spire.ms.System.Collections.IList getKeys()
          List of keys.
 java.lang.Object getSyncRoot()
          Returns the object that can be used to synchronize access to the collection.
 com.spire.ms.System.Collections.IList getValueList()
          Gets the values in the SortedListEx.
 com.spire.ms.System.Collections.IList getValues()
          List of values.
 int indexOfKey(TKey key)
          Returns the zero-based index of the specified key.
 int indexOfValue(TValue value)
          Returns the zero-based index of the first occurrence of the specified value.
 boolean isFixedSize()
          Returns True if collection has fixed size, False otherwise.
 boolean isReadOnly()
          Returns True if list is readonly, False otherwise.
 boolean isSynchronized()
          Returns True if the collection is synchronized, False otherwise.
 boolean remove(TKey key)
          Removes the element with the specified key from SortedListEx.
 void removeAt(int index)
          Removes the element at the specified index.
 void set(TKey key, TValue value)
          Sets the value associated with the specified key.
 void setByIndex(int index, TValue value)
          Replaces the value at the specific index.
 void setCapacity(int value)
           
 void trimToSize()
          Sets the capacity to the actual number of elements.
 

Constructor Detail

TypedSortedListEx

public TypedSortedListEx()
Default constructor.


TypedSortedListEx

public TypedSortedListEx(int initialCapacity)
Creates an empty list with the specified initial capacity.

Parameters:
initialCapacity - Initial capacity. exception:When initialCapacity is less than zero will throw System.ArgumentOutOfRangeException

TypedSortedListEx

public TypedSortedListEx(java.util.Comparator comparer)
Creates an empty SortedList with the default initial capacity and specified comparer.

Parameters:
comparer - The IComparer is used to determine whether two keys are equal.

TypedSortedListEx

public TypedSortedListEx(java.util.Comparator comparer,
                         int capacity)
Creates an empty SortedList with the specified initial capacity and specified comparer.

Parameters:
comparer - Initial capacity.
capacity - The IComparer is used to determine whether two keys are equal.
Method Detail

getCapacity

public int getCapacity()
Capacity of internal buffers

Returns:
int value of the keys array's length

setCapacity

public void setCapacity(int value)

getCount

public int getCount()
FontSize of the collection. Read-only.

Returns:
size of this collection

getKeys

public com.spire.ms.System.Collections.IList getKeys()
List of keys. Read-only.

Returns:
list of keys

getValues

public com.spire.ms.System.Collections.IList getValues()
List of values. Read-only

Returns:
list of values

isReadOnly

public boolean isReadOnly()
Returns True if list is readonly, False otherwise. Read-only.

Returns:
boolean value

isFixedSize

public boolean isFixedSize()
Returns True if collection has fixed size, False otherwise.

Returns:
boolean value

isSynchronized

public boolean isSynchronized()
Returns True if the collection is synchronized, False otherwise.

Returns:
boolean value

getSyncRoot

public java.lang.Object getSyncRoot()
Returns the object that can be used to synchronize access to the collection. Read-only.

Returns:
Object

get

public TValue get(TKey key)
Gets the value associated with the specified key.

Parameters:
key - key
Returns:
value

set

public void set(TKey key,
                TValue value)
Sets the value associated with the specified key.

Parameters:
key - key
value - value

add

public void add(TKey key,
                TValue value)
Adds an element with the provided key and value to the list. When key is null will throw ArgumentNullException When list already contains specified key will throw ArgumentException

Parameters:
key - The Object to use as the key of the element to add.
value - The Object to use as the value of the element to add.

clear

public void clear()
Removes all elements from the collection.


deepClone

public java.lang.Object deepClone()
Creates a new object that is a copy of the current instance.

Returns:
Copy of the current instance

cloneAll

public TypedSortedListEx cloneAll()
Clone current instance.

Returns:
Returns clone of current object.

contains

public boolean contains(TKey key)
Determines whether the list contains an element with the specified key.

Parameters:
key - Key of the element to search
Returns:
True if list contains specified key.

containsKey

public boolean containsKey(TKey key)
Determines whether the list contains an element with the specified key.

Parameters:
key - Key of the element to search
Returns:
True if list contains specified key

containsValue

public boolean containsValue(TValue value)
Determines whether the list contains the specified value.

Parameters:
value - Value of the element to search.
Returns:
True if list contains specified value.

copyTo

public void copyTo(com.spire.ms.System.Array array,
                   int arrayIndex)
Copies all the elements of the SortedListEx to the specified one-dimensional Array starting at the specified destination Array index. If specified array is null will throw ArgumentNullException If rank of the array is not 1 or there are not enough elements will throw ArgumentException If specified arrayIndex is less than zero will throw ArgumentOutOfRangeException

Parameters:
array - The one-dimensional Array that is the destination of the elements copied from the current list.
arrayIndex - The index in array at which copying begins.

getByIndex

public TValue getByIndex(int index)
Gets the value at the specified index of the SortedListEx. When index is less than zero or greater than size of the list will throw ArgumentOutOfRangeException

Parameters:
index - The zero-based index of the value to get.
Returns:
The value at the specified index of the SortedListEx.

getKey

public TKey getKey(int index)
Gets the key at the specified index of the SortedListEx. When index is less than zero or greater than size of the list will throw ArgumentOutOfRangeException

Parameters:
index - The zero-based index of the key to get.
Returns:
The key at the specified index of the SortedListEx.

getKeyList

public com.spire.ms.System.Collections.IList getKeyList()
Gets the keys in the SortedListEx.

Returns:
An IList containing the keys in the SortedListEx.

getValueList

public com.spire.ms.System.Collections.IList getValueList()
Gets the values in the SortedListEx.

Returns:
An IList containing the values in the SortedListEx.

indexOfKey

public int indexOfKey(TKey key)
Returns the zero-based index of the specified key. If specified key is null will throw ArgumentNullException

Parameters:
key - The key to locate
Returns:
The zero-based index of key, if key is found; otherwise, -1.

indexOfValue

public int indexOfValue(TValue value)
Returns the zero-based index of the first occurrence of the specified value.

Parameters:
value - The value to locate (can be NULL).
Returns:
The zero-based index of the first occurrence of value, if value is found; otherwise, -1.

removeAt

public void removeAt(int index)
Removes the element at the specified index. When index is less than zero or greater than size of the list will throw ArgumentOutOfRangeException

Parameters:
index - The zero-based index of the element to remove.

remove

public boolean remove(TKey key)
Removes the element with the specified key from SortedListEx.

Parameters:
key - The key of the element to remove.
Returns:
Removed successful or NOT

setByIndex

public void setByIndex(int index,
                       TValue value)
Replaces the value at the specific index. When index is less than zero or greater than size of the list will throw ArgumentOutOfRangeException

Parameters:
index - The zero-based index at which to save value.
value - The Object to save into. Can be NULL.

trimToSize

public void trimToSize()
Sets the capacity to the actual number of elements.