Class WritableList<E>

Type Parameters:
E - the type of the elements in this list
All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>, IObservable, IObservableCollection<E>, IObservableList<E>

public class WritableList<E> extends ObservableList<E>
Mutable observable list backed by an ArrayList.

This class is thread safe. All state accessing methods must be invoked from the current realm. Methods for adding and removing listeners may be invoked from any thread.

Since:
1.0
  • Constructor Details

    • WritableList

      public WritableList()
      Creates an empty writable list in the default realm with a null element type.
    • WritableList

      public WritableList(Realm realm)
      Creates an empty writable list with a null element type.
      Parameters:
      realm - the observable's realm
    • WritableList

      public WritableList(List<E> toWrap, Object elementType)
      Constructs a new instance with the default realm. Note that for backwards compatibility reasons, the contents of the created WritableList will change with the contents of the given list. If this is not desired, WritableList(Collection, Object) should be used by casting the first argument to Collection.
      Parameters:
      toWrap - The java.util.List to wrap
      elementType - can be null
    • WritableList

      public WritableList(Collection<E> collection, Object elementType)
      Constructs a new instance in the default realm containing the elements of the given collection. Changes to the given collection after calling this method do not affect the contents of the created WritableList.
      Parameters:
      collection - the collection to copy
      elementType - can be null
      Since:
      1.2
    • WritableList

      public WritableList(Realm realm, List<E> toWrap, Object elementType)
      Creates a writable list containing elements of the given type, wrapping an existing client-supplied list. Note that for backwards compatibility reasons, the contents of the created WritableList will change with the contents of the given list. If this is not desired, WritableList(Realm, Collection, Object) should be used by casting the second argument to Collection.
      Parameters:
      realm - the observable's realm
      toWrap - The java.util.List to wrap
      elementType - can be null
    • WritableList

      public WritableList(Realm realm, Collection<E> collection, Object elementType)
      Constructs a new instance in the default realm containing the elements of the given collection. Changes to the given collection after calling this method do not affect the contents of the created WritableList.
      Parameters:
      realm - the observable's realm
      collection - the collection to copy
      elementType - can be null
      Since:
      1.2
  • Method Details