Skip to main content

SynchronizedList

class SynchronizedList

It is a list of Java (Collections.synchronizedList) that incorporates synchronization, which implies that all operations performed on the list are automatically synchronized. This type of list is used to store various types of information, such as components, transformations, and so on.


public class SynchronizedList
implements List

– Constructors (2) –

ConstructorDescription
SynchronizedList()Creates a new empty SynchronizedList.
SynchronizedList(List list)Creates a new SynchronizedList copying all items from the List "list" parameter.

– Methods (25) –

NameDescription
int size()Return the list size.
boolean isEmpty()Return true if the list is empty.
boolean contains(Object value)Return true if the object exists in the list.
boolean remove(Object value)Return true if the object has been removed, return false if the object doesn't exist on that list.
boolean addAll([Collection] value)Return true if all objects are capable of being add on the list, otherwise, false.
boolean addAll(int idx, [Collection] value)Return true if all objects are capable of being add on the list at starting index of i, otherwise, false.
void clear()Remove all objects from the list.
Object get(int idx)Returns the object at the index i on the list, if doesn't exist, return NULL instead.
Object set(int idx, Object value)Set the item object in the index i.
[Iterator] iterator()Returns an iterator over the elements in this list in proper sequence.
Object[] toArray()Returns an array containing all of the elements in this list in proper sequence(from first to last element).
boolean add(Object value)Adds an object to the list.
boolean equals(Object value)Returns true if the value of the list is equal to the argument "value", false if not.
int hashCode()Returns the hash code value for this list.
void add(int idx, Object value)Adds an object to the list at the index defined to be "idx" argument.
Object remove(int idx)Removes an object from the list by its index defined to be "idx" argument.
int indexOf(Object value)Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
int lastIndexOf(Object value)Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
[ListIterator] listIterator()Returns a list iterator over the elements in this list(in proper sequence).
[ListIterator] listIterator(int i)Returns a list iterator over the elements in this list(in proper sequence), starting at the specified position in the list.
[java.util.List] subList(int i, int i1)Returns a view of the portion of this list between the specified "i", inclusive, and "i1", exclusive.
boolean retainAll([Collection] value)Retains only the elements in this list that are contained in the specified collection.
boolean removeAll([Collection] value)Removes all objects from the list that have the same value as defined to be "value" argument.
boolean containsAll([Collection] value)Returns true if all objects in the list have the same value as defined to be argument "value", false if not.
Object[] toArray(Object[] value)Returns an array containing all of the 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.