Class ImmutableObservableList<E>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
com.sun.javafx.collections.ImmutableObservableList<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>, Observable, ObservableList<E>

public class ImmutableObservableList<E> extends AbstractList<E> implements ObservableList<E>
  • Constructor Details

    • ImmutableObservableList

      public ImmutableObservableList(E... elements)
  • Method Details

    • addListener

      public void addListener(InvalidationListener listener)
      Description copied from interface: Observable
      Adds an InvalidationListener which will be notified whenever the Observable becomes invalid. If the same listener is added more than once, then it will be notified more than once. That is, no check is made to ensure uniqueness.

      Note that the same actual InvalidationListener instance may be safely registered for different Observables.

      The Observable stores a strong reference to the listener which will prevent the listener from being garbage collected and may result in a memory leak. It is recommended to either unregister a listener by calling removeListener after use or to use an instance of WeakInvalidationListener avoid this situation.

      Specified by:
      addListener in interface Observable
      Parameters:
      listener - The listener to register
      See Also:
    • removeListener

      public void removeListener(InvalidationListener listener)
      Description copied from interface: Observable
      Removes the given listener from the list of listeners, that are notified whenever the value of the Observable becomes invalid.

      If the given listener has not been previously registered (i.e. it was never added) then this method call is a no-op. If it had been previously added then it will be removed. If it had been added more than once, then only the first occurrence will be removed.

      Specified by:
      removeListener in interface Observable
      Parameters:
      listener - The listener to remove
      See Also:
    • addListener

      public void addListener(ListChangeListener<? super E> listener)
      Description copied from interface: ObservableList
      Add a listener to this observable list.
      Specified by:
      addListener in interface ObservableList<E>
      Parameters:
      listener - the listener for listening to the list changes
    • removeListener

      public void removeListener(ListChangeListener<? super E> listener)
      Description copied from interface: ObservableList
      Tries to removed a listener from this observable list. If the listener is not attached to this list, nothing happens.
      Specified by:
      removeListener in interface ObservableList<E>
      Parameters:
      listener - a listener to remove
    • addAll

      public boolean addAll(E... elements)
      Description copied from interface: ObservableList
      A convenient method for var-arg adding of elements.
      Specified by:
      addAll in interface ObservableList<E>
      Parameters:
      elements - the elements to add
      Returns:
      true (as specified by Collection.add(E))
    • setAll

      public boolean setAll(E... elements)
      Description copied from interface: ObservableList
      Clears the ObservableList and add all the elements passed as var-args.
      Specified by:
      setAll in interface ObservableList<E>
      Parameters:
      elements - the elements to set
      Returns:
      true (as specified by Collection.add(E))
    • setAll

      public boolean setAll(Collection<? extends E> col)
      Description copied from interface: ObservableList
      Clears the ObservableList and add all elements from the collection.
      Specified by:
      setAll in interface ObservableList<E>
      Parameters:
      col - the collection with elements that will be added to this observableArrayList
      Returns:
      true (as specified by Collection.add(E))
    • removeAll

      public boolean removeAll(E... elements)
      Description copied from interface: ObservableList
      A convenient method for var-arg usage of removaAll method.
      Specified by:
      removeAll in interface ObservableList<E>
      Parameters:
      elements - the elements to be removed
      Returns:
      true if list changed as a result of this call
    • retainAll

      public boolean retainAll(E... elements)
      Description copied from interface: ObservableList
      A convenient method for var-arg usage of retain method.
      Specified by:
      retainAll in interface ObservableList<E>
      Parameters:
      elements - the elements to be retained
      Returns:
      true if list changed as a result of this call
    • remove

      public void remove(int from, int to)
      Description copied from interface: ObservableList
      Basically a shortcut to sublist(from, to).clear() As this is a common operation, ObservableList has this method for convenient usage.
      Specified by:
      remove in interface ObservableList<E>
      Parameters:
      from - the start of the range to remove (inclusive)
      to - the end of the range to remove (exclusive)
    • get

      public E get(int index)
      Specified by:
      get in interface List<E>
      Specified by:
      get in class AbstractList<E>
    • size

      public int size()
      Specified by:
      size in interface Collection<E>
      Specified by:
      size in interface List<E>
      Specified by:
      size in class AbstractCollection<E>