|
Parsing Engine | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FixedSizeList
Specifies methods for a list of a fixed size. As a consequence of having
fixed size, several of the optional operations from List
are
overridden here to document explicitly that they should not be
supported. Another consequence is that all implementors should have at
least one argument in their constructors that is an int
,
to specify the fixed size of the list to be created, and all elements are
initially null
unless otherwise set via a constructor. A
final consequence is that the shift(Object)
method may be
efficiently implemented for lists of fixed size, by employing a circular
buffer (indeed, this was one of the prime motivations for the creation of
this interface).
Method Summary | |
---|---|
void |
add(int index,
Object element)
Implementors should simply throw an UnsupportedOperationException . |
boolean |
add(Object o)
A synonym for shift(Object) . |
boolean |
addAll(Collection c)
Sets the first n elements of this list to be the elements of the specified collection, where n is the minimum of the size of the collection and the (fixed) size of this list. |
boolean |
addAll(int index,
Collection c)
Implementors should simply throw an UnsupportedOperationException . |
void |
clear()
Sets all elements of this list to null . |
Object |
remove(int index)
Implementors should simply throw an UnsupportedOperationException . |
boolean |
remove(Object o)
Implementors should simply throw an UnsupportedOperationException . |
boolean |
removeAll(Collection c)
Implementors should simply throw an UnsupportedOperationException . |
boolean |
retainAll(Collection c)
Implementors should simply throw an UnsupportedOperationException . |
boolean |
shift(Object obj)
Shifts the specified object to the beginning of the list, that is, causes the specified object to be the value at index 0, causes the object at index size() - 1 to be removed and causes the index of all other objects to be increased by 1. |
Methods inherited from interface java.util.List |
---|
contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, set, size, subList, toArray, toArray |
Method Detail |
---|
void add(int index, Object element)
UnsupportedOperationException
.
add
in interface List
boolean add(Object o)
shift(Object)
.
add
in interface Collection
add
in interface List
o
- the object to be shifted into the first position of this list
Collection.add
method)boolean addAll(Collection c)
addAll
in interface Collection
addAll
in interface List
c
- the collection whose elements are to become the elements of
this list
boolean addAll(int index, Collection c)
UnsupportedOperationException
.
addAll
in interface List
void clear()
null
.
clear
in interface Collection
clear
in interface List
Object remove(int index)
UnsupportedOperationException
.
remove
in interface List
boolean remove(Object o)
UnsupportedOperationException
.
remove
in interface Collection
remove
in interface List
boolean removeAll(Collection c)
UnsupportedOperationException
.
removeAll
in interface Collection
removeAll
in interface List
boolean retainAll(Collection c)
UnsupportedOperationException
.
retainAll
in interface Collection
retainAll
in interface List
boolean shift(Object obj)
Implementation advice: This method may be implemented to take constant (that is, O(1)) time if the employed data struture is a circular buffer.
obj
- the object to be shifted into this list
Collection.add
method)
|
Parsing Engine | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |