Class XWorkList

All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection, List, RandomAccess

public class XWorkList extends ArrayList
A simple list that guarantees that inserting and retrieving objects will always work regardless of the current size of the list. Upon insertion, type conversion is also performed if necessary. Empty beans will be created to fill the gap between the current list size and the requested index using ObjectFactory's buildBean method.
Author:
Patrick Lightbody
See Also:
  • Constructor Details

    • XWorkList

      public XWorkList(Class clazz)
    • XWorkList

      public XWorkList(Class clazz, int initialCapacity)
  • Method Details

    • add

      public void add(int index, Object element)

      Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

      This method is guaranteed to work since it will create empty beans to fill the gap between the current list size and the requested index to enable the element to be set. This method also performs any necessary type conversion.

      Specified by:
      add in interface List
      Overrides:
      add in class ArrayList
      Parameters:
      index - index at which the specified element is to be inserted.
      element - element to be inserted.
    • add

      public boolean add(Object element)

      Appends the specified element to the end of this list.

      This method performs any necessary type conversion.

      Specified by:
      add in interface Collection
      Specified by:
      add in interface List
      Overrides:
      add in class ArrayList
      Parameters:
      element - element to be appended to this list.
      Returns:
      true (as per the general contract of Collection.add).
    • addAll

      public boolean addAll(Collection collection)

      Appends all of the elements in the specified Collection to the end of this list, in the order that they are returned by the specified Collection's Iterator. The behavior of this operation is undefined if the specified Collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified Collection is this list, and this list is nonempty.)

      This method performs any necessary type conversion.

      Specified by:
      addAll in interface Collection
      Specified by:
      addAll in interface List
      Overrides:
      addAll in class ArrayList
      Parameters:
      collection - the elements to be inserted into this list.
      Returns:
      true if this list changed as a result of the call.
      Throws:
      NullPointerException - if the specified collection is null.
    • addAll

      public boolean addAll(int index, Collection collection)

      Inserts all of the elements in the specified Collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified Collection's iterator.

      This method is guaranteed to work since it will create empty beans to fill the gap between the current list size and the requested index to enable the element to be set. This method also performs any necessary type conversion.

      Specified by:
      addAll in interface List
      Overrides:
      addAll in class ArrayList
      Parameters:
      index - index at which to insert first element from the specified collection.
      collection - elements to be inserted into this list.
      Returns:
      true if this list changed as a result of the call.
    • get

      public Object get(int index)

      Returns the element at the specified position in this list.

      An object is guaranteed to be returned since it will create empty beans to fill the gap between the current list size and the requested index.

      Specified by:
      get in interface List
      Overrides:
      get in class ArrayList
      Parameters:
      index - index of element to return.
      Returns:
      the element at the specified position in this list.
    • set

      public Object set(int index, Object element)

      Replaces the element at the specified position in this list with the specified element.

      This method is guaranteed to work since it will create empty beans to fill the gap between the current list size and the requested index to enable the element to be set. This method also performs any necessary type conversion.

      Specified by:
      set in interface List
      Overrides:
      set in class ArrayList
      Parameters:
      index - index of element to replace.
      element - element to be stored at the specified position.
      Returns:
      the element previously at the specified position.
    • contains

      public boolean contains(Object element)
      Specified by:
      contains in interface Collection
      Specified by:
      contains in interface List
      Overrides:
      contains in class ArrayList