E
- the type of the list elementspublic class LinkedListModel<E> extends LinkedList<E> implements ObservableList2<E>
ListModel
capabilities to its superclass.
It allows to observe changes in the content and structure. Useful for
Lists that are bound to list views such as JList, JComboBox and JTable.This class should be be final and it will be marked final in a future version, if its subclass in the JGoodies Binding has been removed.
ObservableList
,
ArrayListModel
,
Serialized FormmodCount
Constructor and Description |
---|
LinkedListModel()
Constructs an empty LinkedListModel.
|
LinkedListModel(Collection<? extends E> c)
Constructs a LinkedListModel containing the elements of the specified
collection, in the order they are returned by the collection's
iterator.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(E e) |
void |
add(int index,
E element) |
boolean |
addAll(int index,
Collection<? extends E> c) |
void |
addFirst(E e) |
void |
addLast(E e) |
void |
addListDataListener(ListDataListener l) |
void |
clear() |
void |
fireContentsChanged(int index)
Notifies all registered
ListDataListeners that the element
at the specified index has changed. |
void |
fireContentsChanged(int index0,
int index1)
Notifies all registered
ListDataListeners that the element
at the specified index has changed. |
E |
getElementAt(int index) |
ListDataListener[] |
getListDataListeners()
Returns an array of all the list data listeners
registered on this
LinkedListModel . |
int |
getSize() |
ListIterator<E> |
listIterator(int index) |
E |
remove(int index) |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c)
Removes from this collection all of its elements that are contained in
the specified collection (optional operation).
|
E |
removeFirst() |
E |
removeLast() |
void |
removeListDataListener(ListDataListener l) |
protected void |
removeRange(int fromIndex,
int toIndex) |
boolean |
retainAll(Collection<?> c)
Retains only the elements in this collection that are contained in the
specified collection (optional operation).
|
E |
set(int index,
E element) |
addAll, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, removeFirstOccurrence, removeLastOccurrence, size, spliterator, toArray, toArray
iterator
equals, hashCode, listIterator, subList
containsAll, isEmpty, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, replaceAll, size, sort, spliterator, subList, toArray, toArray
parallelStream, removeIf, stream
public LinkedListModel()
public LinkedListModel(Collection<? extends E> c)
c
- the collection whose elements are to be placed into this list.NullPointerException
- if c
is null
public final void add(int index, E element)
public final boolean add(E e)
public final boolean addAll(int index, Collection<? extends E> c)
public boolean removeAll(Collection<?> c)
This implementation iterates over this collection, checking each element returned by the iterator in turn to see if it's contained in the specified collection. If it's so contained, it's removed from this collection with the iterator's remove method.
Note that this implementation will throw an UnsupportedOperationException if the iterator returned by the iterator method does not implement the remove method and this collection contains one or more elements in common with the specified collection.
removeAll
in interface Collection<E>
removeAll
in interface List<E>
removeAll
in class AbstractCollection<E>
c
- elements to be removed from this collection.UnsupportedOperationException
- if the removeAll method
is not supported by this collection.NullPointerException
- if the specified collection is null.remove(Object)
,
LinkedList.contains(Object)
public boolean retainAll(Collection<?> c)
This implementation iterates over this collection, checking each element returned by the iterator in turn to see if it's contained in the specified collection. If it's not so contained, it's removed from this collection with the iterator's remove method.
Note that this implementation will throw an UnsupportedOperationException if the iterator returned by the iterator method does not implement the remove method and this collection contains one or more elements not present in the specified collection.
retainAll
in interface Collection<E>
retainAll
in interface List<E>
retainAll
in class AbstractCollection<E>
c
- elements to be retained in this collection.UnsupportedOperationException
- if the retainAll method
is not supported by this Collection.NullPointerException
- if the specified collection is null.remove(Object)
,
LinkedList.contains(Object)
public final void addFirst(E e)
public final void addLast(E e)
public final void clear()
clear
in interface Collection<E>
clear
in interface List<E>
clear
in class LinkedList<E>
public final E remove(int index)
public final boolean remove(Object o)
public final E removeFirst()
removeFirst
in interface Deque<E>
removeFirst
in class LinkedList<E>
public final E removeLast()
removeLast
in interface Deque<E>
removeLast
in class LinkedList<E>
protected final void removeRange(int fromIndex, int toIndex)
removeRange
in class AbstractList<E>
public final ListIterator<E> listIterator(int index)
listIterator
in interface List<E>
listIterator
in class LinkedList<E>
public final void addListDataListener(ListDataListener l)
addListDataListener
in interface ListModel
public final void removeListDataListener(ListDataListener l)
removeListDataListener
in interface ListModel
public final E getElementAt(int index)
getElementAt
in interface ListModel
public final void fireContentsChanged(int index)
ObservableList2
ListDataListeners
that the element
at the specified index has changed. Useful if there's a content change
without any structural change.This method must be called after the element of the list changes.
fireContentsChanged
in interface ObservableList2<E>
index
- the index of the element that has changedEventListenerList
public final void fireContentsChanged(int index0, int index1)
ListDataListeners
that the element
at the specified index has changed. Useful if there's a content change
without any structural change.This method must be called after one or more elements of the list change. The changed elements are specified by the closed interval index0, index1 -- the end points are included. Note that index0 need not be less than or equal to index1.
fireContentsChanged
in interface ObservableList2<E>
index0
- one end of the new intervalindex1
- the other end of the new intervalEventListenerList
public final ListDataListener[] getListDataListeners()
LinkedListModel
.ListDataListener
s,
or an empty array if no list data listeners
are currently registeredaddListDataListener(ListDataListener)
,
removeListDataListener(ListDataListener)
Copyright © 2014 JGoodies Software GmbH. All rights reserved.