org.jgroups.util
Class List
- Cloneable, Externalizable
public class List
extends java.lang.Object
implements Externalizable, Cloneable
Doubly-linked list. Elements can be added at head or tail and removed from head/tail.
This class is tuned for element access at either head or tail, random access to elements
is not very fast; in this case use Vector. Concurrent access is supported: a thread is blocked
while another thread adds/removes an object. When no objects are available, removal returns null.
- Bela Ban
protected org.jgroups.util.List.Element | head
|
protected Object | mutex
|
protected int | size
|
protected org.jgroups.util.List.Element | tail
|
void | add(Object obj) - Adds an object at the tail of the list.
|
void | addAtHead(Object obj) - Adds an object at the head of the list.
|
protected Object | clone()
|
boolean | contains(Object obj)
|
List | copy()
|
String | dump()
|
Enumeration | elements()
|
Vector | getContents()
|
static void | main(String[] args)
|
Object | peek() - Returns element at the tail (if present), but does not remove it from list.
|
Object | peekAtHead() - Returns element at the head (if present), but does not remove it from list.
|
void | readExternal(ObjectInput in)
|
Object | remove() - Removes an object from the tail of the list.
|
void | removeAll()
|
Object | removeElement(Object obj) - Removes element
obj from the list, checking for equality using the equals
operator.
|
Object | removeFromHead() - Removes an object from the head of the list.
|
int | size()
|
String | toString()
|
void | writeExternal(ObjectOutput out)
|
head
protected org.jgroups.util.List.Element head
mutex
protected Object mutex
tail
protected org.jgroups.util.List.Element tail
add
public void add(Object obj)
Adds an object at the tail of the list.
addAtHead
public void addAtHead(Object obj)
Adds an object at the head of the list.
clone
protected Object clone()
contains
public boolean contains(Object obj)
elements
public Enumeration elements()
getContents
public Vector getContents()
main
public static void main(String[] args)
peek
public Object peek()
Returns element at the tail (if present), but does not remove it from list.
peekAtHead
public Object peekAtHead()
Returns element at the head (if present), but does not remove it from list.
readExternal
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
remove
public Object remove()
Removes an object from the tail of the list. Returns null if no elements available
removeAll
public void removeAll()
removeElement
public Object removeElement(Object obj)
Removes element obj
from the list, checking for equality using the equals
operator. Only the first duplicate object is removed. Returns the removed object.
removeFromHead
public Object removeFromHead()
Removes an object from the head of the list. Returns null if no elements available
toString
public String toString()
writeExternal
public void writeExternal(ObjectOutput out)
throws IOException
Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.