Class SafeArray<T>

java.lang.Object
com.j_spaces.kernel.SafeArray<T>
All Implemented Interfaces:
ISafeArray<T>

public class SafeArray<T> extends Object implements ISafeArray<T>
Safe use "array", to use when ArrayIndexOutOfBoundsException might accord. Notice: This implementation is not Thread safe.
Since:
5.1
Version:
1.0
Author:
Guy Korland
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an empty safe array with an initial capacity of ten.
    SafeArray(int initialCapacity)
    Constructs an empty safe array with the specified initial capacity.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(int index, T element)
    Inserts the specified element at the specified position in this list.
    void
    Clears the array
    get(int index)
    Returns the element at the specified position in this list.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SafeArray

      public SafeArray(int initialCapacity)
      Constructs an empty safe array with the specified initial capacity.
      Parameters:
      initialCapacity - the initial capacity of the list.
      Throws:
      IllegalArgumentException - if the specified initial capacity is negative
    • SafeArray

      public SafeArray(SafeArray<T> copy)
    • SafeArray

      public SafeArray()
      Constructs an empty safe array with an initial capacity of ten.
  • Method Details

    • get

      public T get(int index)
      Description copied from interface: ISafeArray
      Returns the element at the specified position in this list.
      Specified by:
      get in interface ISafeArray<T>
      Parameters:
      index - index of element to return.
      Returns:
      the element at the specified position in this list.
    • add

      public void add(int index, T element)
      Description copied from interface: ISafeArray
      Inserts the specified element at the specified position in this list.
      Specified by:
      add in interface ISafeArray<T>
      Parameters:
      index - index at which the specified element is to be inserted.
      element - element to be inserted.
    • clear

      public void clear()
      Description copied from interface: ISafeArray
      Clears the array
      Specified by:
      clear in interface ISafeArray<T>