E
- the element type has to implement the Comparable
interfacepublic class SortedListModel<E>
extends javax.swing.AbstractListModel<E>
AbstractListModel
and can be used as sorted model in a JList.Constructor and Description |
---|
SortedListModel() |
Modifier and Type | Method and Description |
---|---|
void |
add(E element)
Adds the specified element.
|
void |
addAll(E[] elements)
Adds all elements specified in the array.
|
void |
addElement(E element)
Adds the specified element.
|
void |
clear()
Clear.
|
boolean |
contains(java.lang.Object element)
Checks if the list contains the specified element.
|
java.lang.Object |
firstElement()
Return the first element in the list.
|
E |
get(int index)
Returns the element at the specified index position.
|
E |
getElementAt(int index) |
int |
getSize() |
java.util.Iterator<E> |
iterator()
Returns an Iterator of the list elements.
|
java.lang.Object |
lastElement()
Return the last element in the list.
|
boolean |
removeElement(java.lang.Object element)
Removes the specified element.
|
public int getSize()
public E get(int index)
index
- the indexpublic E getElementAt(int index)
public void add(E element)
element
- the elementpublic void addElement(E element)
element
- the elementpublic void addAll(E[] elements)
elements
- the elementspublic boolean removeElement(java.lang.Object element)
element
- the elementpublic void clear()
public boolean contains(java.lang.Object element)
element
- the elementpublic java.lang.Object firstElement()
public java.lang.Object lastElement()
public java.util.Iterator<E> iterator()