| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsky.monome.util.SynchronizedList<T>
T - Type of the contained data.public final class SynchronizedList<T>
Unbounded list with strong synchronization.
 
 This list works like an ArrayList since it internally contains an ArrayList.
 
 This class is strongly thread-safe for all its methods. But you should iterate on it with external synchronization based on the internal lock object
 accessible with the getLockObject() method specified by the Synchronized interface.
Synchronized| Constructor Summary | |
|---|---|
| SynchronizedList()Constructs an empty synchronized list. | |
| Method Summary | ||
|---|---|---|
|  void | add(int index,
    T element)Adds the specified object to this list at the specified index. | |
|  boolean | add(T e)Adds the specified object to this list. | |
|  boolean | addAll(java.util.Collection<? extends T> c)Adds all objects of the specified collection to this list. | |
|  boolean | addAll(int index,
       java.util.Collection<? extends T> c)Adds all objects of the specified collection to this list at the specified index. | |
|  void | clear()Clears this list. | |
|  boolean | contains(java.lang.Object o)Indicates whether this list contains the specified object. | |
|  boolean | containsAll(java.util.Collection<?> c)Indicates whether this list contains all objects of the specified collection at the same time. | |
|  boolean | equals(java.lang.Object obj)Compares the specified object with this list for equality. | |
|  T | get(int index)Returns the object stored at the specified index in this list. | |
|  java.lang.Object | getLockObject()Returns the object over which the internal and external synchronization will operate. | |
|  int | hashCode()Returns the hashcode of this list. | |
|  int | indexOf(java.lang.Object o)Returns the index of the specified object in this list. | |
|  boolean | isEmpty()Indicates whether this list is empty. | |
|  boolean | isValidIndex(int index)Verifies that the specified index is valid for this list. | |
|  java.util.Iterator<T> | iterator()Returns an iterator to iterate over this list. | |
|  int | lastIndexOf(java.lang.Object o)Returns the index of the last occurrence of the specified object in this list. | |
|  java.util.ListIterator<T> | listIterator()Returns a list iterator to iterate over this list. | |
|  java.util.ListIterator<T> | listIterator(int index)Returns a list iterator to iterate over this list from the specified index. | |
|  T | remove(int index)Removes the object at the specified index from this list. | |
|  boolean | remove(java.lang.Object o)Removes the specified object from this list. | |
|  boolean | removeAll(java.util.Collection<?> c)Removes all objects from this list that are also contained in the specified collection. | |
|  boolean | retainAll(java.util.Collection<?> c)Retains only all objects also contained by the specified collection. | |
|  T | set(int index,
    T element)Stores the specified object at the specified index. | |
|  int | size()Returns the size of this list. | |
|  java.util.List<T> | subList(int fromIndex,
        int toIndex)Deprecated. Since the sublist will share the same internal data, there will be no consistent synchronization anymore by manipulating the sublist. | |
|  java.lang.Object[] | toArray()Returns an array of objects contained in this list. | |
| 
 | toArray(T[] a)Returns an array containing all of elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array. | |
|  java.lang.String | toString()Returns a string representation of this list. | |
| Methods inherited from class java.lang.Object | 
|---|
| clone, finalize, getClass, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public SynchronizedList()
| Method Detail | 
|---|
public boolean add(T e)
add in interface java.util.Collection<T>add in interface java.util.List<T>e - Object to add to this list.
true.
public void add(int index,
                T element)
add in interface java.util.List<T>index - Index in this list at which the specified object will be inserted.element - Object to add to this list at the specified index.public boolean addAll(java.util.Collection<? extends T> c)
addAll in interface java.util.Collection<T>addAll in interface java.util.List<T>c - Collection from which all objects will be added to this list.
true if this list was modified as a result of the call, false otherwise.
public boolean addAll(int index,
                      java.util.Collection<? extends T> c)
addAll in interface java.util.List<T>index - Index in this list at which specified objects will be inserted.c - Collection from which all objects will be added to this list.
true if this list was modified as a result of the call, false otherwise.public void clear()
clear in interface java.util.Collection<T>clear in interface java.util.List<T>public boolean contains(java.lang.Object o)
contains in interface java.util.Collection<T>contains in interface java.util.List<T>o - Object whose presence in this list is to be tested.
true if this list contains the specified object, false otherwise.public boolean containsAll(java.util.Collection<?> c)
containsAll in interface java.util.Collection<T>containsAll in interface java.util.List<T>c - Collection whose presence of all objects in this list is to be tested.
true if this list contains all objects of the specified collection at the same time, false otherwise.public boolean equals(java.lang.Object obj)
true if and only if the specified object is also a list, both
 lists have the same size, and all corresponding pairs of elements in
 the two lists are equal. (Two elements e1 and
 e2 are equal if (e1==null ? e2==null :
 e1.equals(e2)).) In other words, two lists are defined to be
 equal if they contain same elements in the same order.
equals in interface java.util.Collection<T>equals in interface java.util.List<T>equals in class java.lang.Objectobj - The object to be compared for equality with this list.
true if the specified object is equal to this list, false otherwise.public T get(int index)
get in interface java.util.List<T>index - Index of the desired object.
public int hashCode()
hashCode in interface java.util.Collection<T>hashCode in interface java.util.List<T>hashCode in class java.lang.Objectpublic int indexOf(java.lang.Object o)
indexOf in interface java.util.List<T>o - Object to search for.
public boolean isEmpty()
isEmpty in interface java.util.Collection<T>isEmpty in interface java.util.List<T>true if this list is empty, false otherwise.public java.util.Iterator<T> iterator()
iterator in interface java.lang.Iterable<T>iterator in interface java.util.Collection<T>iterator in interface java.util.List<T>public int lastIndexOf(java.lang.Object o)
lastIndexOf in interface java.util.List<T>o - Object to search for.
public java.util.ListIterator<T> listIterator()
listIterator in interface java.util.List<T>public java.util.ListIterator<T> listIterator(int index)
listIterator in interface java.util.List<T>index - Index from which the iterator will iterate.
public boolean remove(java.lang.Object o)
remove in interface java.util.Collection<T>remove in interface java.util.List<T>o - Object to remove from this list.
true if this list is modified as a result of the call, false otherwise.public T remove(int index)
remove in interface java.util.List<T>index - Index of the object which needs to be removed from this list.
public boolean removeAll(java.util.Collection<?> c)
removeAll in interface java.util.Collection<T>removeAll in interface java.util.List<T>c - Collection from which objects also contained in this list will be removed.
true if this list is modified as a result of the call.public boolean retainAll(java.util.Collection<?> c)
retainAll in interface java.util.Collection<T>retainAll in interface java.util.List<T>c - Collection from which only objects also contained will be retained.
true if this list is modified as a result of the call.
public T set(int index,
             T element)
set in interface java.util.List<T>index - Index at which the specified object will be stored.element - Object to store at the specified index in this list.
public int size()
size in interface java.util.Collection<T>size in interface java.util.List<T>
@Deprecated
public java.util.List<T> subList(int fromIndex,
                                            int toIndex)
subList in interface java.util.List<T>fromIndex - Index from which the sublist is built (inclusive).toIndex - Index to which the sublist is built (exclusive).
public java.lang.Object[] toArray()
toArray in interface java.util.Collection<T>toArray in interface java.util.List<T>public <T> T[] toArray(T[] a)
If the list fits in the specified array with room to spare (i.e., the array has more elements than the list), the element in the array immediately following the end of the collection is set to null. (This is useful in determining the length of the list only if the caller knows that the list does not contain any null elements.)
toArray in interface java.util.Collection<T>toArray in interface java.util.List<T>T - Type of contained elementsa - The array into which elements of the list are to
          be stored, if it is big enough; otherwise, a new array of the
          same runtime type is allocated for this purpose.
java.lang.ArrayStoreException - If the runtime type of the specified array
         is not a supertype of the runtime type of every element in
         this list.
java.lang.NullPointerException - If the specified array is null.public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isValidIndex(int index)
index - Index to verify.
true if the specified index is in the range [0;size()[, false otherwise.public java.lang.Object getLockObject()
getLockObject in interface Synchronized| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||