org.apache.avro.generic

## Class GenericData.Array<T>

- java.lang.Object
- - java.util.AbstractCollection<E>
  - - java.util.AbstractList<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 AbstractList<T>
      implements GenericArray<T>, Comparable<GenericArray<T>>

  Default implementation of an array.

- - ### Field Summary

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

      `modCount`

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(int location, T o)`
    `void` | `clear()`
    `int` | `compareTo(GenericArray<T> that)`
    `T` | `get(int i)`
    `Schema` | `getSchema()` The schema of this instance.
    `Iterator<T>` | `iterator()`
    `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)`
    `void` | `reset()` reset size counter of array to zero
    `void` | `reverse()` Reverses the order of the elements in this array.
    `T` | `set(int i, T o)`
    `int` | `size()`

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

      `add, addAll, equals, hashCode, 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.List

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

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

      `parallelStream, removeIf, stream`

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

      `forEach`

- - ### Constructor Detail

    - #### Array

          public Array(int capacity,
                       Schema schema)

    - #### Array

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

  - ### Method Detail

    - #### getSchema

          public Schema getSchema()

      Description copied from interface: `GenericContainer`
      The schema of this instance.
      Specified by:
        `getSchema` in interface `GenericContainer`

    - #### size

          public int size()

      Specified by:
        `size` in interface `Collection<T>`
      Specified by:
        `size` in interface `List<T>`
      Specified by:
        `size` in class `AbstractCollection<T>`

    - #### clear

          public void clear()

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

    - #### reset

          public void reset()

      Description copied from interface: `GenericArray`
      reset size counter of array to zero
      Specified by:
        `reset` in interface `GenericArray<T>`

    - #### prune

          public void prune()

      Description copied from interface: `GenericArray`
      clean up reusable objects from array (if reset didn't already)
      Specified by:
        `prune` in interface `GenericArray<T>`

    - #### iterator

          public Iterator<T> iterator()

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

    - #### 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.
      Specified by:
        `peek` in interface `GenericArray<T>`

    - #### compareTo

          public int compareTo(GenericArray<T> that)

      Specified by:
        `compareTo` in interface `Comparable<GenericArray<T>>`

    - #### reverse

          public void reverse()

      Description copied from interface: `GenericArray`
      Reverses the order of the elements in this array.
      Specified by:
        `reverse` in interface `GenericArray<T>`

Copyright © 2009–2024 The Apache Software Foundation. All rights reserved.