com.mapinfo.midev.feature.util

## Class AttributeDefinitionCollection

- java.lang.Object
- - com.mapinfo.midev.feature.util.AttributeDefinitionCollection

All Implemented Interfaces:
  Serializable, Iterable

    public final class AttributeDefinitionCollection
    extends Object
    implements Iterable, Serializable

An ordered collection of zero or more `IAttributeDefinitions`. An `IAttributeDefinition` can be looked up either via an integer index or by attribute name. Lookups by attribute name are case-insensitive.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`AttributeDefinitionCollection(AttributeDefinitionCollection collection)` Creates a `AttributeValueCollection` from another `AttributeValueCollection`.
`AttributeDefinitionCollection(List list)` Creates a `AttributeValueCollection` from the specified List of `IAttributeDefinitions`.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `contains(Object o)` Returns `true` if this list contains the specified object.
`boolean` `equals(Object o)`
`IAttributeDefinition` `get(int index)` Returns the `IAttributeDefinition` at the specified index.
`IAttributeDefinition` `get(String name)` Returns an `IAttributeDefinition` with the specified name.
`int` `hashCode()`
`int` `indexOf(Object o)` Returns the index of the specified Object or -1 if not found.
`boolean` `isEmpty()` Returns `true` if this list is empty; `false` if not.
`Iterator` `iterator()` Returns an `Iterator` over this list of `IAttributeDefinitions`.
`int` `lastIndexOf(Object o)` Returns the last index of the specified Object or -1 if not found.
`ListIterator` `listIterator()` Returns a `ListIterator` to iterate over this list of `IAttributeDefinitions`.
`ListIterator` `listIterator(int index)` Returns a `ListIterator` to iterate over this list of `IAttributeDefinitions`.
`int` `size()` Returns the number of `IAttributeDefinitions` in this list.
`List` `toList()` Returns this `AttributeDefinitionCollection` as a `List<IAttributeDefinition>`.

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

`getClass, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

### Constructor Detail

#### AttributeDefinitionCollection

    public AttributeDefinitionCollection(List list)

Creates a `AttributeValueCollection` from the specified List of `IAttributeDefinitions`.

Parameters:
  `list` - the `List` of `IAttributeDefinitions` to create this list with.
Throws:
  `IllegalArgumentException` - if the specified list is null.

#### AttributeDefinitionCollection

    public AttributeDefinitionCollection(AttributeDefinitionCollection collection)

Creates a `AttributeValueCollection` from another `AttributeValueCollection`.

Parameters:
  `collection` - the `AttributeDefinitionCollection` to create this list with.
Throws:
  `IllegalArgumentException` - if he specified list is null.

### Method Detail

#### size

    public int size()

Returns the number of `IAttributeDefinitions` in this list.

Returns:
  the number of `IAttributeDefinitions` in this list.

#### isEmpty

    public boolean isEmpty()

Returns `true` if this list is empty; `false` if not.

Returns:
  `true` if this list is empty; `false` if not.

#### contains

    public boolean contains(Object o)

Returns `true` if this list contains the specified object. The specified object can either be an IAttributeDefinition or a String.

Parameters:
  `o` - The object to test for containment within this List.
Returns:
  `true` if this list contains the specified object.

#### iterator

    public Iterator iterator()

Returns an `Iterator` over this list of `IAttributeDefinitions`. The returned `Iterator`'s remove method will throw an `UnsupportedOperationException` when invoked.

Specified by:
  `iterator` in interface `Iterable`
Returns:
  an `Iterator` over this list of `IAttributeDefinitions`.

#### get

    public IAttributeDefinition get(String name)

Returns an `IAttributeDefinition` with the specified name. More than one `IAttributeDefinition` can have the same name so caution must be used in assuming that the `IAttributeDefinition` returned from this method is the only `IAttributeDefinition` with the specified name in this collection.

Parameters:
  `name` - The name of the `IAttributeDefinition` to return.
Returns:
  an `IAttributeDefinition` with the specified name.

#### get

    public IAttributeDefinition get(int index)

Returns the `IAttributeDefinition` at the specified index.

Parameters:
  `index` - The index in the list to get the `IAttributeDefinition` from.
Returns:
  the `IAttributeDefinition` at the specified index.

#### indexOf

    public int indexOf(Object o)

Returns the index of the specified Object or -1 if not found. The `Object` may be either an `IAttributeDefinition` or a `String`. If a `String` is specified then the index of the first `IAttributeDefinition` in the list with the specified name will be returned.

Parameters:
  `o` - The `IAttributeDefinition` or attribute definition name to get the index of.
Returns:
  the index of the specified Object or -1 if not found. \

#### lastIndexOf

    public int lastIndexOf(Object o)

Returns the last index of the specified Object or -1 if not found. The Object may be either an `IAttributeDefinition` or a String. If a String is specified then the index of the last `IAttributeDefinition` in the list with the specified name will be returned.

Parameters:
  `o` - The `IAttributeDefinition` or attribute definition name to get the index of.
Returns:
  the index of the specified Object or -1 if not found. \

#### listIterator

    public ListIterator listIterator()

Returns a `ListIterator` to iterate over this list of `IAttributeDefinitions`. The Iterator is placed just before the first item in the list. Calling `Iterator.remove()`, `ListIterator.add(Object)`, or `ListIterator.set(Object)` on this iterator will result in an `UnsupportedOperationException` being thrown.

Returns:
  a `ListIterator` to iterate over this list of `IAttributeDefinitions`.

#### listIterator

    public ListIterator listIterator(int index)

Returns a `ListIterator` to iterate over this list of `IAttributeDefinitions`. The `Iterator` is placed just before the specified item in the list. Calling `Iterator.remove()` on this iterator will result in an `UnsupportedOperationException` being thrown.

Parameters:
  `index` - The index to place the `Iterator` at.
Returns:
  a `ListIterator` to iterate over this list of `IAttributeDefinitions`.

#### toList

    public List toList()

Returns this `AttributeDefinitionCollection` as a `List<IAttributeDefinition>`. Changes to this `AttributeDefinitionCollection` are not reflected in the returned `List` and vise-versa.

Returns:
  this `AttributeDefinitionCollection` as a `List<IAttributeDefinition>`.

#### equals

    public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`