Class ArrayCanvasList
- java.lang.Object
- 
- org.pepstock.charba.client.commons.ArrayCanvasList
 
- 
 public final class ArrayCanvasList extends Object An ordered collection (also known as a sequence). The user of this interface has precise control over where in the list each element is inserted.
 The user can access elements by their integer index (position in the list), and search for elements in the list.
 This implementation uses a java script array as back-end to store objects (canvas).- Author:
- Andrea "Stock" Stocchero
- See Also:
- ArrayCanvas
 
- 
- 
Constructor SummaryConstructors Constructor Description ArrayCanvasList()Creates an empty list
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, Canvas element)Inserts the specified element at the specified position in this list.
 Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).booleanadd(Canvas element)Appends the specified element to the end of this listbooleanaddAll(int index, Collection<? extends E> collection)booleanaddAll(Collection<? extends E> collection)Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iteratorvoidaddAll(Canvas... values)Loads an array of elements in the listprotected booleancheckRange(int index)Checks if the index is in the right range.voidclear()Removes all of the elements from this list.booleancontains(Object object)Returns true if this list contains the specified element.booleancontainsAll(Collection<?> collection)Returns true if this list contains all of the elements of the specified collection.Canvasget(int index)Returns the element at the specified position in this list.intindexOf(Object object)Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.booleanisEmpty()Returns true if this list contains no elementsIterator<E>iterator()Returns an iterator over the elements in this list in proper sequence.intlastIndexOf(Object object)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<E>listIterator()Returns a list iterator over the elements in this listListIterator<E>listIterator(int index)Returns a list iterator over the elements in this list (in proper sequence), starting at the specified position in the list.
 The specified index indicates the first element that would be returned by an initial call to next.
 An initial call to previous would return the element with the specified index minus one.Canvasremove(int index)Removes the element at the specified position in this list.
 Shifts any subsequent elements to the left (subtracts one from their indices).booleanremove(Object object)Removes the first occurrence of the specified element from this list, if it is present.booleanremoveAll(Collection<?> collection)Removes from this list all of its elements that are contained in the specified collection.booleanretainAll(Collection<?> collection)Retains only the elements in this list that are contained in the specified collection.
 In other words, removes from this list all of its elements that are not contained in the specified collection.Canvasset(int index, Canvas element)Replaces the element at the specified position in this list with the specified element.intsize()Returns the number of elements in this list.List<E>subList(int fromIndex, int toIndex)Not implementedObject[]toArray()<T> T[]toArray(T[] a)StringtoString()- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface java.util.CollectionparallelStream, removeIf, stream, toArray
 - 
Methods inherited from interface java.util.Listequals, hashCode, replaceAll, sort, spliterator
 
- 
 
- 
- 
- 
Method Detail- 
addAllpublic void addAll(Canvas... values) Loads an array of elements in the list- Parameters:
- values- an array of elements to be loaded
 
 - 
addpublic boolean add(Canvas element) Appends the specified element to the end of this list
 - 
retainAllpublic boolean retainAll(Collection<?> collection) Retains only the elements in this list that are contained in the specified collection.
 In other words, removes from this list all of its elements that are not contained in the specified collection.
 - 
clearpublic void clear() Removes all of the elements from this list. The list will be empty after this call returns.
 - 
getpublic Canvas get(int index) Returns the element at the specified position in this list. If index out of range, returns null
 - 
setpublic Canvas set(int index, Canvas element) Replaces the element at the specified position in this list with the specified element. If index out of range, returns null
 - 
addpublic void add(int index, Canvas element)Inserts the specified element at the specified position in this list.
 Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
 - 
removepublic Canvas remove(int index) Removes the element at the specified position in this list.
 Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.
 - 
indexOfpublic int indexOf(Object object) Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
 - 
lastIndexOfpublic int lastIndexOf(Object object) Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
 - 
toArraypublic Object[] toArray() 
 - 
sizepublic int size() Returns the number of elements in this list.- Specified by:
- sizein interface- Collection<E>
- Specified by:
- sizein interface- List<E>
 
 - 
isEmptypublic boolean isEmpty() Returns true if this list contains no elements- Specified by:
- isEmptyin interface- Collection<E>
- Specified by:
- isEmptyin interface- List<E>
 
 - 
containspublic boolean contains(Object object) Returns true if this list contains the specified element.- Specified by:
- containsin interface- Collection<E>
- Specified by:
- containsin interface- List<E>
 
 - 
iteratorpublic Iterator<E> iterator() Returns an iterator over the elements in this list in proper sequence.
 - 
toArraypublic <T> T[] toArray(T[] a) - Specified by:
- toArrayin interface- Collection<E>
- Specified by:
- toArrayin interface- List<E>
 
 - 
listIteratorpublic ListIterator<E> listIterator() Returns a list iterator over the elements in this list- Specified by:
- listIteratorin interface- List<E>
 
 - 
addAllpublic final boolean addAll(int index, Collection<? extends E> collection)
 - 
removepublic final boolean remove(Object object) Removes the first occurrence of the specified element from this list, if it is present. If this list does not contain the element, it is unchanged.- Specified by:
- removein interface- Collection<E>
- Specified by:
- removein interface- List<E>
 
 - 
addAllpublic boolean addAll(Collection<? extends E> collection) Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator- Specified by:
- addAllin interface- Collection<E>
- Specified by:
- addAllin interface- List<E>
 
 - 
containsAllpublic boolean containsAll(Collection<?> collection) Returns true if this list contains all of the elements of the specified collection.- Specified by:
- containsAllin interface- Collection<E>
- Specified by:
- containsAllin interface- List<E>
 
 - 
removeAllpublic final boolean removeAll(Collection<?> collection) Removes from this list all of its elements that are contained in the specified collection.- Specified by:
- removeAllin interface- Collection<E>
- Specified by:
- removeAllin interface- List<E>
 
 - 
listIteratorpublic ListIterator<E> listIterator(int index) Returns a list iterator over the elements in this list (in proper sequence), starting at the specified position in the list.
 The specified index indicates the first element that would be returned by an initial call to next.
 An initial call to previous would return the element with the specified index minus one.- Specified by:
- listIteratorin interface- List<E>
 
 - 
subListpublic List<E> subList(int fromIndex, int toIndex) Not implemented
 - 
checkRangeprotected final boolean checkRange(int index) Checks if the index is in the right range.- Parameters:
- index- index to be checked
- Returns:
- trueif the index is in the right range otherwise false
 
 
- 
 
-