Module javafx.base

Class ModifiableObservableListBase<E>

Type Parameters:
E - the type of the elements contained in the List
All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>, Observable, ObservableList<E>

public abstract class ModifiableObservableListBase<E>
extends ObservableListBase<E>
Abstract class that serves as a base class for ObservableList implementations that are modifiable. To implement a modifiable ObservableList class, you just need to implement the following set of methods: and the notifications and built and fired automatically for you.

Example of a simple ObservableList delegating to another List would look like this:


   public class ArrayObservableList<E> extends ModifiableObservableList<E> {

   private final List<E> delegate = new ArrayList<>();

   public E get(int index) {
       return delegate.get(index);
   }

   public int size() {
       return delegate.size();
   }

   protected void doAdd(int index, E element) {
       delegate.add(index, element);
   }

   protected E doSet(int index, E element) {
       return delegate.set(index, element);
   }

   protected E doRemove(int index) {
       return delegate.remove(index);
   }

 
Since:
JavaFX 8.0
See Also:
ObservableListBase
  • Constructor Details

    • ModifiableObservableListBase

      public ModifiableObservableListBase()
      Creates a default ModifiableObservableListBase.
  • Method Details