Package org.apache.avro.generic

# Class GenericData.Array<T>

java.lang.Object
java.util.AbstractCollection<T>
java.util.AbstractList<T>
org.apache.avro.generic.GenericData.AbstractArray<T>
org.apache.avro.generic.GenericData.Array<T>

All Implemented Interfaces:
  `Comparable<GenericArray<T>>`, `Iterable<T>`, `Collection<T>`, `List<T>`, `GenericArray<T>`, `GenericContainer`

Enclosing class:
  `GenericData`

public static class GenericData.Array<T> extends GenericData.AbstractArray<T>
Default implementation of an array.

## Field Summary

### Fields inherited from class org.apache.avro.generic.GenericData.AbstractArray

`size`

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

`modCount`

## Constructor Summary

Constructors
Constructor
Description
`Array(int capacity, Schema schema)`
`Array(Schema schema, Collection<T> c)`

## Method Summary

Modifier and Type
Method
Description
`void`
`add(int location, T o)`
`void`
`clear()`
`T`
`get(int i)`
`T`
`peek()`
The current content of the location where `List.add(Object)` would next store an element, if any.
`void`
`prune()`
clean up reusable objects from array (if reset didn't already)
`T`
`remove(int i)`
`T`
`set(int i, T o)`
`protected void`
`swap(int index1, int index2)`

### Methods inherited from class org.apache.avro.generic.GenericData.AbstractArray

`compareTo, equals, getSchema, hashCode, iterator, reset, reverse, size`

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

`add, addAll, indexOf, lastIndexOf, listIterator, listIterator, removeRange, subList`

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

`addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString`

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

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

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

`parallelStream, removeIf, stream, toArray`

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

`forEach`

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

`add, addAll, addAll, contains, containsAll, indexOf, isEmpty, lastIndexOf, listIterator, listIterator, remove, removeAll, replaceAll, retainAll, sort, spliterator, subList, toArray, toArray`

## Constructor Details

### Array

public Array(int capacity, Schema schema)

### Array

public Array(Schema schema, Collection<T> c)

## Method Details

### clear

public void clear()

Specified by:
  `clear` in interface `Collection<T>`
Specified by:
  `clear` in interface `List<T>`
Overrides:
  `clear` in class `AbstractList<T>`

### prune

public void prune()
Description copied from interface: `GenericArray`
clean up reusable objects from array (if reset didn't already)

### get

public T get(int i)

Specified by:
  `get` in interface `List<T>`
Specified by:
  `get` in class `AbstractList<T>`

### add

public void add(int location, T o)

Specified by:
  `add` in interface `List<T>`
Overrides:
  `add` in class `AbstractList<T>`

### set

public T set(int i, T o)

Specified by:
  `set` in interface `List<T>`
Overrides:
  `set` in class `AbstractList<T>`

### remove

public T remove(int i)

Specified by:
  `remove` in interface `List<T>`
Overrides:
  `remove` in class `AbstractList<T>`

### peek

public T peek()
Description copied from interface: `GenericArray`
The current content of the location where `List.add(Object)` would next store an element, if any. This permits reuse of arrays and their elements without allocating new objects.

### swap

protected void swap(int index1, int index2)

Specified by:
  `swap` in class `GenericData.AbstractArray<T>`