Package org.eclipse.net4j.util.collection

## Class ConcurrentArray<E>

- java.lang.Object
- - org.eclipse.net4j.util.collection.ConcurrentArray<E>

- Direct Known Subclasses:
    `ConcurrentArray.DuplicateCounter`, `ConcurrentArray.Unique`, `FastList`

      public abstract class ConcurrentArray<E>
      extends java.lang.Object

  Since:
    3.2
  Author:
    Eike Stepper

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `ConcurrentArray.DuplicateCounter<E>` |
    `static class` | `ConcurrentArray.Unique<E>` |

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected E[]` | `elements` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ConcurrentArray()` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `add​(E element)` |
    `boolean` | `addUnique​(E element)` |
    `boolean` | `contains​(E element)` |
    `protected void` | `elementAdded​(E element)` | Synchronized through `add(Object)`.
    `protected void` | `elementRemoved​(E element)` | Synchronized through `remove(Object)`.
    `protected boolean` | `equals​(E e1, E e2)` |
    `protected void` | `firstElementAdded()` | Synchronized through `add(Object)`.
    `E[]` | `get()` | Returns the elements, never `null`.
    `boolean` | `isEmpty()` |
    `protected void` | `lastElementRemoved()` | Synchronized through `remove(Object)`.
    `protected abstract E[]` | `newArray​(int length)` | Synchronized through `add(Object)` or `remove(Object)`.
    `boolean` | `remove​(E element)` |
    `protected boolean` | `validate​(E element)` |

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### elements

          protected volatile E[] elements

  - ### Constructor Detail

    - #### ConcurrentArray

          public ConcurrentArray()

  - ### Method Detail

    - #### isEmpty

          public boolean isEmpty()

    - #### get

          public E[] get()

      Returns the elements, never `null`.

    - #### contains

          public boolean contains​(E element)

      Since:
        3.13

    - #### addUnique

          public boolean addUnique​(E element)

      Since:
        3.13

    - #### add

          public void add​(E element)

    - #### remove

          public boolean remove​(E element)

    - #### validate

          protected boolean validate​(E element)

    - #### equals

          protected boolean equals​(E e1,
                                   E e2)

      Since:
        3.13

    - #### elementAdded

          protected void elementAdded​(E element)

      Synchronized through `add(Object)`.
      Since:
        3.13

    - #### elementRemoved

          protected void elementRemoved​(E element)

      Synchronized through `remove(Object)`.
      Since:
        3.13

    - #### firstElementAdded

          protected void firstElementAdded()

      Synchronized through `add(Object)`.

    - #### lastElementRemoved

          protected void lastElementRemoved()

      Synchronized through `remove(Object)`.

    - #### newArray

          protected abstract E[] newArray​(int length)

      Synchronized through `add(Object)` or `remove(Object)`.