Package org.eclipse.net4j.util.container

# Class ModifiableContainer<E>

java.lang.Object
org.eclipse.net4j.util.event.Notifier
org.eclipse.net4j.util.lifecycle.Lifecycle
org.eclipse.net4j.util.lifecycle.ShareableLifecycle
org.eclipse.net4j.util.container.Container<E>
org.eclipse.net4j.util.container.ModifiableContainer<E>

All Implemented Interfaces:
  `IContainer<E>`, `IContainer.Modifiable<E>`, `INotifier`, `INotifier.INotifier2`, `IDeactivateable`, `ILifecycle`, `ILifecycle.DeferrableActivation`

Direct Known Subclasses:
  `PersistableContainer`

public abstract class ModifiableContainer<E> extends Container<E> implements IContainer.Modifiable<E>
An abstract implementation of a `modifiable container`.

Since:
  3.18
Author:
  Eike Stepper

## Nested Class Summary

## Nested classes/interfaces inherited from class org.eclipse.net4j.util.event.Notifier

`Notifier.Cancelation`

## Nested classes/interfaces inherited from interface org.eclipse.net4j.util.container.IContainer

`IContainer.Modifiable<E>, IContainer.Persistable<E>, IContainer.Persistence<E>`

## Nested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle

`ILifecycle.DeferrableActivation`

## Nested classes/interfaces inherited from interface org.eclipse.net4j.util.event.INotifier

`INotifier.INotifier2`

## Field Summary

### Fields inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle

`USE_LABEL`

## Constructor Summary

Constructors
Constructor
Description
`ModifiableContainer(Class<E> componentType)`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`addAllElements(Collection<E> elements)`
`boolean`
`addElement(E element)`
`protected abstract boolean`
`backingStoreAdd(E element)`
`protected abstract void`
`backingStoreClear()`
`protected abstract boolean`
`backingStoreContains(E element)`
`protected abstract void`
`backingStoreForEach(Consumer<E> consumer)`
`protected abstract boolean`
`backingStoreIsEmpty()`
`protected abstract boolean`
`backingStoreRemove(E element)`
`protected abstract int`
`backingStoreSize()`
`protected abstract E[]`
`backingStoreToArray(E[] a)`
`void`
`clear()`
`protected void`
`containerModified()`
Called outside synchronized(this).
`protected void`
`elementAdded(E element)`
Called inside synchronized(this).
`protected void`
`elementRemoved(E element)`
Called inside synchronized(this).
`protected void`
`firstElementAdded(E element)`
Called inside synchronized(this).
`final Class<E>`
`getComponentType()`
`E[]`
`getElements()`
`boolean`
`isEmpty()`
`protected void`
`lastElementRemoved(E element)`
Called inside synchronized(this).
`boolean`
`removeAllElements(Collection<E> elements)`
`boolean`
`removeElement(E element)`
`protected E[]`
`sortElements(E[] array)`
Called outside synchronized(this).
`protected boolean`
`validateElement(E element)`
Called outside synchronized(this).

### Methods inherited from class org.eclipse.net4j.util.container.Container

`fireContainerEvent, fireContainerEvent, fireContainerEvent, fireElementAddedEvent, fireElementRemovedEvent, fireElementsAddedEvent, fireElementsRemovedEvent, fireEvent, newContainerEvent, newContainerEvent`

### Methods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle

`activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doActivate, doAfterActivate, doBeforeActivate, doBeforeDeactivate, doDeactivate, dump, getLifecycleState, isActive, isDeferredActivation, toString`

### Methods inherited from class org.eclipse.net4j.util.event.Notifier

`addListener, addUniqueListener, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListener, hasListeners, lastListenerRemoved, listenerAdded, listenerRemoved, removeListener`

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

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

### Methods inherited from interface org.eclipse.net4j.util.event.INotifier

`addListener, getListeners, hasListeners, removeListener`

## Constructor Details

### ModifiableContainer

public ModifiableContainer(Class<E> componentType)

## Method Details

### getComponentType

public final Class<E> getComponentType()

### isEmpty

public boolean isEmpty()

Specified by:
  `isEmpty` in interface `IContainer<E>`
Overrides:
  `isEmpty` in class `Container<E>`

### getElements

public E[] getElements()

Specified by:
  `getElements` in interface `IContainer<E>`

### addElement

public boolean addElement(E element)

Specified by:
  `addElement` in interface `IContainer.Modifiable<E>`

### addAllElements

public boolean addAllElements(Collection<E> elements)

Specified by:
  `addAllElements` in interface `IContainer.Modifiable<E>`

### removeElement

public boolean removeElement(E element)

Specified by:
  `removeElement` in interface `IContainer.Modifiable<E>`

### removeAllElements

public boolean removeAllElements(Collection<E> elements)

Specified by:
  `removeAllElements` in interface `IContainer.Modifiable<E>`

### clear

public void clear()

### sortElements

protected E[] sortElements(E[] array)
Called outside synchronized(this).

### validateElement

protected boolean validateElement(E element)
Called outside synchronized(this).

### containerModified

protected void containerModified()
Called outside synchronized(this).

### firstElementAdded

protected void firstElementAdded(E element)
Called inside synchronized(this).

Since:
  3.24

### elementAdded

protected void elementAdded(E element)
Called inside synchronized(this).

### elementRemoved

protected void elementRemoved(E element)
Called inside synchronized(this).

### lastElementRemoved

protected void lastElementRemoved(E element)
Called inside synchronized(this).

Since:
  3.24

### backingStoreIsEmpty

protected abstract boolean backingStoreIsEmpty()

### backingStoreSize

protected abstract int backingStoreSize()

### backingStoreToArray

protected abstract E[] backingStoreToArray(E[] a)

### backingStoreForEach

protected abstract void backingStoreForEach(Consumer<E> consumer)

### backingStoreContains

protected abstract boolean backingStoreContains(E element)

### backingStoreAdd

protected abstract boolean backingStoreAdd(E element)

### backingStoreRemove

protected abstract boolean backingStoreRemove(E element)

### backingStoreClear

protected abstract void backingStoreClear()