net.fortuna.ical4j.model

## Class ComponentList

- java.lang.Object
- - java.util.AbstractCollection<E>
  - - java.util.AbstractList<E>
    - - java.util.ArrayList
      - - net.fortuna.ical4j.model.ComponentList

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

    public class ComponentList
    extends ArrayList
    implements Serializable

$Id$ [Apr 5, 2004] Defines a list of iCalendar components.

Author:
  Ben Fortuna
See Also:
  Serialized Form

### Field Summary

### Fields inherited from class java.util.AbstractList

`modCount`

### Constructor Summary

Constructors
Constructor and Description
`ComponentList()` Default constructor.
`ComponentList(ComponentList components)` Creates a deep copy of the specified component list.
`ComponentList(int initialCapacity)` Creates a new instance with the specified initial capacity.

### Method Summary

Methods
`boolean` `add(Component component)` Add a component to the list.
`boolean` `add(Object component)` Overrides superclass to throw an `IllegalArgumentException` where argument is not a `net.fortuna.ical4j.model.Component`.
`Component` `getComponent(String aName)` Returns the first component of specified name.
`ComponentList` `getComponents(String name)` Returns a list containing all components with specified name.
`boolean` `remove(Component component)` Remove a component from the list.
`String` `toString()`

### Methods inherited from class java.util.ArrayList

`add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeRange, retainAll, set, size, subList, toArray, toArray, trimToSize`

### Methods inherited from class java.util.AbstractList

`equals, hashCode`

### Methods inherited from class java.util.AbstractCollection

`containsAll`

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

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.util.List

`containsAll, equals, hashCode`

### Constructor Detail

#### ComponentList

    public ComponentList()

Default constructor.

#### ComponentList

    public ComponentList(int initialCapacity)

Creates a new instance with the specified initial capacity.

Parameters:
  `initialCapacity` - the initial capacity of the list

#### ComponentList

    public ComponentList(ComponentList components)
                  throws ParseException,
                         IOException,
                         URISyntaxException

Creates a deep copy of the specified component list.

Parameters:
  `components` - a component list to copy
Throws:
  `IOException` - where an error occurs reading component data
  `ParseException` - where component data cannot be parsed
  `URISyntaxException` - where component data contains an invalid URI

### Method Detail

#### toString

    public final String toString()

Overrides:
  `toString` in class `AbstractCollection`

#### getComponent

    public final Component getComponent(String aName)

Returns the first component of specified name.

Parameters:
  `aName` - name of component to return
Returns:
  a component or null if no matching component found

#### getComponents

    public final ComponentList getComponents(String name)

Returns a list containing all components with specified name.

Parameters:
  `name` - name of components to return
Returns:
  a list of components with the matching name

#### add

    public final boolean add(Component component)

Add a component to the list.

Parameters:
  `component` - the component to add
Returns:
  true
See Also:
  `List.add(Object)`

#### add

    public final boolean add(Object component)

Overrides superclass to throw an `IllegalArgumentException` where argument is not a `net.fortuna.ical4j.model.Component`.

Specified by:
  `add` in interface `Collection`
Specified by:
  `add` in interface `List`
Overrides:
  `add` in class `ArrayList`
Parameters:
  `component` - a component to add
Returns:
  true if the object was added, otherwise false
See Also:
  `List.add(Object)`

#### remove

    public final boolean remove(Component component)

Remove a component from the list.

Parameters:
  `component` - the component to remove
Returns:
  true if the list contained the specified component
See Also:
  `List.remove(java.lang.Object)`