cdac.medinfo.sdk.hl7282.utils

## Class SingleCollection<T>

- java.lang.Object
- - cdac.medinfo.sdk.hl7282.utils.SingleCollection<T>

- Type Parameters:
    `T` - Spcifies type of which singleCollection is formed.
  All Implemented Interfaces:
    ICollectionIterable<T>, ISingleCollection<T>, java.lang.Iterable<T>

      public class SingleCollection<T>
      extends java.lang.Object
      implements ISingleCollection<T>

  This class provides an abstract mechanism of holding a collection.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SingleCollection()` This constructor creats vector of type T.
    `SingleCollection(int iSize)` This constructor creats collection of size iSize.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `add(T objT)` This method provides a mechanism for adding an elemtn to the collection.
    `boolean` | `addAll(java.util.List<T> collection)` Adds any collection into this collection.
    `boolean` | `contains(T objT)` Tests if the specified element is peresent in the collection.
    `boolean` | `containsAll(ISingleCollection<T> objSingleCollection)` Returns true if this collection contains all of the elements in the specified collection otherwise false.
    `T` | `elementAt(int iIndex)` Returns element at specified index.
    `ICollectionIterator<T>` | `iterator()` Returns an iterator over the internal collection.
    `void` | `remove(int iIndex)` Removes the element at the specified index.
    `void` | `remove(java.lang.Object objectToRemove)` Removes the element at the specified index.
    `int` | `size()` Returns number of elements in the collection.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SingleCollection

          public SingleCollection()

      This constructor creats vector of type T.

    - #### SingleCollection

          public SingleCollection(int iSize)

      This constructor creats collection of size iSize.
      Parameters:
        `iSize` - Size of the collection.

  - ### Method Detail

    - #### iterator

          public ICollectionIterator<T> iterator()

      Returns an iterator over the internal collection.
      Specified by:
        `iterator` in interface `ICollectionIterable<T>`
      Specified by:
        `iterator` in interface `java.lang.Iterable<T>`
      Returns:
        ICollectionIterator<T> - returns the iterator over the internal collection.

    - #### add

          public boolean add(T objT)

      This method provides a mechanism for adding an elemtn to the collection.
      Specified by:
        `add` in interface `ISingleCollection<T>`
      Parameters:
        `objT` - object specified at the time of instantiation of the implementor class.
      Returns:
        boolean - status indicating whether the element is added or not.

    - #### addAll

          public boolean addAll(java.util.List<T> collection)

      Adds any collection into this collection.
      Specified by:
        `addAll` in interface `ISingleCollection<T>`
      Parameters:
        `collection` - object of any class collection .
      Returns:
        boolean - true if collection is successfully added .

    - #### contains

          public boolean contains(T objT)

      Tests if the specified element is peresent in the collection.
      Specified by:
        `contains` in interface `ISingleCollection<T>`
      Parameters:
        `objT` - object of the type user specifies at the time of instantiation of this interface.
      Returns:
        boolean - true if elemnent is present in the collection.

    - #### elementAt

          public T elementAt(int iIndex)

      Returns element at specified index.
      Specified by:
        `elementAt` in interface `ISingleCollection<T>`
      Parameters:
        `iIndex` - the integer indicating the position of the element to be retrieved from the collection.
      Returns:
        object - object of the type user specifies at the time of instantiation of this interface.

    - #### remove

          public void remove(int iIndex)

      Removes the element at the specified index.
      Specified by:
        `remove` in interface `ISingleCollection<T>`
      Parameters:
        `iIndex` - position of the element.

    - #### remove

          public void remove(java.lang.Object objectToRemove)

      Removes the element at the specified index.
      Specified by:
        `remove` in interface `ISingleCollection<T>`
      Parameters:
        `objectToRemove` - position of the element.

    - #### size

          public int size()

      Returns number of elements in the collection.
      Specified by:
        `size` in interface `ISingleCollection<T>`
      Returns:
        int - number of elements in the collection.

    - #### containsAll

          public boolean containsAll(ISingleCollection<T> objSingleCollection)

      Returns true if this collection contains all of the elements in the specified collection otherwise false.
      Specified by:
        `containsAll` in interface `ISingleCollection<T>`
      Parameters:
        `objSingleCollection` - whose elements will be tested for containment in this SingleCollection.
      Returns:
        true if this SingleCollection contains all of the elements in the specified Collection otherwise false.