Class AssociationList
- All Implemented Interfaces:
MetadataState,Serializable,Cloneable,Iterable,Collection,List,SequencedCollection
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected MdObjectListThis is the object used for list interactions internally.protected intThe number of times this list has been structurally modified.Fields inherited from interface com.sas.metadata.remote.MetadataState
AL_ALL, AL_ITEM_ADDED, AL_ITEM_CHANGED, AL_ITEM_REMOVED, AL_LOCALSET, AL_PARTIALSET, AL_SETFROMSERVER, AL_UNCHANGED, AL_UPDATEALL, LOCAL, MD_CHGMGT_CHECKEDOUT, MD_CHGMGT_FETCHED, MD_CHGMGT_NEW, MD_CHGMGT_UNSET, MD_OBJECT_MODIFIED, MD_OBJECT_NOT_MODIFIED, MD_OBJECT_STALE, MD_OBJECT_UNSET, SERVER, UNSET -
Constructor Summary
ConstructorsConstructorDescriptionAssociationList(String strAssociationName) Constructs an empty List so that its internal data array has size 10 and its standard capacity increment is zero.AssociationList(String strAssociationName, boolean remoteEnvironment) Constructs an empty List so that its internal data array has size 10 and its standard capacity increment is zero.AssociationList(String strAssociationName, int initialCapacity) Constructs an empty List with the specified initial capacity and with its capacity increment equal to zero.AssociationList(String strAssociationName, int initialCapacity, boolean remoteEnvironment) Constructs an empty List with the specified initial capacity and with its capacity increment equal to zero.AssociationList(String strAssociationName, int initialCapacity, int capacityIncrement) Deprecated.this constructor is no longer supportedAssociationList(String strAssociationName, Object obj) Constructs an empty List so that its internal data array has size 10 and its standard capacity increment is zero.AssociationList(String strAssociationType, String strAssociationName, boolean isPredAssoc, String properties, CMetadata parentObj) Constructs an empty AssociationList with capacity 10 and the properties set accordingly.AssociationList(String strAssociationName, Collection<CMetadata> c) Constructs a List containing the elements of the specified collection, in the order they are returned by the collection's iterator.AssociationList(String strAssociationName, Collection<CMetadata> c, CMetadata parentObj) Constructs a List containing the elements of the specified collection, in the order they are returned by the collection's iterator. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int index, Object element) Inserts the specified element at the specified position in this List.booleanadd(Object obj) Appends the specified element to the end of this List.protected booleanadd(Object obj, int state) Deprecated.REMOVED FROM APIprotected booleanadd(Object obj, int state, boolean processOtherSideOfAssn) Deprecated.REMOVED FROM API.booleanaddAll(int index, Collection c) Inserts all of the elements in in the specified Collection into this List at the specified position.booleanaddAll(Collection c) 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.voidaddElement(Object obj) Adds the specified component to the end of this List, increasing its size by one.booleancontains(Object obj) Tests if the specified object is a component in this List.booleancontainsAll(Collection c) Returns true if this List contains all of the elements in the specified Collection.voidcopyInto(Object[] anArray) Copies the components of this List into the specified array.voiddispose()Clears object and all memory used by object.ObjectelementAt(int index) Returns the component at the specified index.Enumerationelements()Returns an enumeration of the components of this List.voidensureCapacity(int minCapacity) Increases the capacity of this List, if necessary, to ensure that it can hold at least the number of components specified by the minimum capacity argument.ObjectReturns the first component (the item at index 0) of this List.voidflushAll()Use this to empty out the list in preperation for deleting itStringgenerateAssociationAllXML(boolean fRequired, String callingObjectID) Create the XML string for this association list objectStringgenerateAssociationWriteXML(boolean fRequired, String callingObjectID) Create the XML string for this association list objectStringgenerateAssociationXML(boolean fRequired, String callingObjectID) Create the XML string for this association list objectStringGenerates a replacement XML String that is empty.StringGenerates Function=Remove XML for this listObjectget(int index) Returns the element at the specified position in this List.StringGets the association NameStringGets the associationType of this associationList<String> Returns the deleted items or null if no deleted items.MdObjectListbooleanGets whether this is the pred side of the association or notbooleanIs this association required for add.StringGet min cardinality for this associationStringGet min cardinality for this associationprotected ObjectgetObjectforID(String ID) Deprecated.REMOVED FROM APIprotected ObjectgetObjectforID(String ID, boolean hashOnly) Deprecated.REMOVED FROM APIVector<String> Returns the List of object ids in this list.protected AssociationListgetOppositeAssn(String otherID) Deprecated.REMOVED FROM API.Returns the parent object of this associationlist.StringintgetState()Returns a flag that tells if the user has added or removed items.inthashCode()Returns the hash code value for this List.intindexOf(Object elem) Searches for the first occurence of the given argument, testing for equality using theequalsmethod.intindexOf(Object elem, int index) Searches for the first occurence of the given argument, beginning the search atindex, and testing for equality using theequalsmethod.voidinsertElementAt(Object obj, int index) Inserts the specified object as a component in this List at the specifiedindex.voidinsertElementAt(Object obj, int index, boolean objectModified) Inserts the specified object as a component in this List at the specifiedindex.booleanisEmpty()Tests if this List has no components.booleanReturns whether or not to go to the server to populate an association.Iteratoriterator()Returns an iterator over the elements in this list in proper sequence.ObjectReturns the last component of the List.intlastIndexOf(Object elem) Returns the index of the last occurrence of the specified object in this List.intlastIndexOf(Object elem, int index) Searches backwards for the specified object, starting from the specified index, and returns an index to it.ListIteratorReturns an iterator of the elements in this list (in proper sequence).ListIteratorlistIterator(int index) Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in the list.Objectremove(int index) Removes the element at the specified position in this List.booleanremove(Object o) Removes the first occurrence of the specified element in this List If the List does not contain the element, it is unchanged.booleanremoveAll(Collection c) Removes from this List all of its elements that are contained in the specified Collection.voidRemoves all components from this List and sets its size to zero.voidremoveAllElements(boolean objectChanged) Removes all components from this List and sets its size to zero.booleanremoveElement(Object obj) Removes the first (lowest-indexed) occurrence of the argument from this List.booleanremoveElement(Object obj, boolean processOtherSide) Removes the first (lowest-indexed) occurrence of the argument from this List.voidremoveElementAt(int index) Deletes the component at the specified index.protected voidremoveOppositeAssn(String otherID) Deprecated.REMOVED FROM API.protected voidremoveRange(int fromIndex, int toIndex) Deprecated.REMOVED FROM APIvoidresetState(int iValue) Removes the value from the existing state.voidresetState(int iValue, boolean forceState) Removes the value from the existing state.booleanretainAll(Collection c) Retains only the elements in this List that are contained in the specified Collection.Objectset(int index, Object obj) Replaces the element at the specified position in this List with the specified element.voidsetAssociationType(String type) Sets the associationType of this associationvoidsetElementAt(Object obj, int index) Sets the component at the specifiedindexof this List to be the specified object.voidsetIsPredAssoc(boolean ispred) Sets whether this is the pred side of the association or not.voidsetObjectIDs(List<String> newIds) Sets the current list to be the new list.protected voidsetOppositeAssn(String otherID) Deprecated.REMOVED FROM API.voidSets the parent object of this associationList.voidsetProperties(String inProperties) Sets the properties of this association.voidsetSize(int newSize) Sets the size of this List.voidsetState(int iValue) ORs the value with the existing state.voidsetState(int iValue, boolean AddToChangeIfChanged) ORs the value with the existing state. depending on existing state and passed in value.intsize()Returns the number of components in this List.List<CMetadata> subList(int fromIndex, int toIndex) Returns a view of the portion of this List between fromIndex, inclusive, and toIndex, exclusive.Object[]toArray()Returns an array containing all of the elements in this List in the correct order.Object[]toArray(Object[] a) Returns an array containing all of the elements in this List in the correct order.StringtoString()Returns a string representation of this collection.voidTrims the capacity of this List to be the List's current size.voidupdateObjectID(String strOldId, String strNewId) Change the hash key associated with an object, and notify listenersvoidUpdates the opposite side assn for all object currently in listMethods inherited from class java.util.AbstractList
equalsMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.lang.Iterable
forEachMethods inherited from interface java.util.List
addFirst, addLast, getFirst, getLast, removeFirst, removeLast, replaceAll, reversed, sort, spliterator
-
Field Details
-
modCount
protected transient int modCountThe number of times this list has been structurally modified. Structural modifications are those that change the size of the list, or otherwise perturb it in such a fashion that iterations in progress may yield incorrect results.This field is used by the iterator and list iterator implementation returned by the iterator and listIterator methods. If the value of this field changes unexpectedly, the iterator (or list iterator) will throw a ConcurrentModificationException in response to the next, remove, previous, set or add operations. This provides fail-fast behavior, rather than non-deterministic behavior in the face of concurrent modification during iteration.
Use of this field by subclasses is optional. If a subclass wishes to provide fail-fast iterators (and list iterators), then it merely has to increment this field in its add(int, Object) and remove(int) methods (and any other methods that it overrides that result in structural modifications to the list). A single call to add(int, Object) or remove(int) must add no more than one to this field, or the iterators (and list iterators) will throw bogus ConcurrentModificationExceptions. If an implementation does not wish to provide fail-fast iterators, this field may be ignored.
-
list_object
protected MdObjectList list_objectThis is the object used for list interactions internally.
-
-
Constructor Details
-
AssociationList
public AssociationList(String strAssociationName, int initialCapacity, int capacityIncrement) Deprecated.this constructor is no longer supportedConstructs an empty List with the specified initial capacity and capacity increment.- Parameters:
initialCapacity- the initial capacity of the List.capacityIncrement- the amount by which the capacity is increased when the List overflows.- Throws:
IllegalArgumentException- if the specified initial capacity is negative
-
AssociationList
public AssociationList(String strAssociationName) Constructs an empty List so that its internal data array has size 10 and its standard capacity increment is zero.- Parameters:
strAssociationName- name of the associaiton
-
AssociationList
public AssociationList(String strAssociationName, int initialCapacity) Constructs an empty List with the specified initial capacity and with its capacity increment equal to zero.- Parameters:
strAssociationName- the name of the associationinitialCapacity- the initial capacity of the List.- Throws:
IllegalArgumentException- if the specified initial capacity is negative
-
AssociationList
public AssociationList(String strAssociationName, int initialCapacity, boolean remoteEnvironment) Constructs an empty List with the specified initial capacity and with its capacity increment equal to zero.- Parameters:
strAssociationName- the name of the associationinitialCapacity- the initial capacity of the List.remoteEnvironment- true if the client is in a remote environment- Throws:
IllegalArgumentException- if the specified initial capacity is negative
-
AssociationList
public AssociationList(String strAssociationName, boolean remoteEnvironment) Constructs an empty List so that its internal data array has size 10 and its standard capacity increment is zero.- Parameters:
strAssociationName- name of the associaitonremoteEnvironment- true if the client is in a remote environment
-
AssociationList
public AssociationList(String strAssociationType, String strAssociationName, boolean isPredAssoc, String properties, CMetadata parentObj) Constructs an empty AssociationList with capacity 10 and the properties set accordingly.- Parameters:
strAssociationType- The type of association this is "Column-Table"strAssociationName- The name of the association, ColumnsisPredAssoc- is this a predicate side of the association.properties- The properties of this association.parentObj- The object this association belongs to.
-
AssociationList
public AssociationList(String strAssociationName, Object obj) Constructs an empty List so that its internal data array has size 10 and its standard capacity increment is zero.- Parameters:
strAssociationName- Stringobj- Object
-
AssociationList
Constructs a List containing the elements of the specified collection, in the order they are returned by the collection's iterator.- Parameters:
strAssociationName- The name of the association. For instance "Columns".c- the collection whose elements are to be placed into this List.- Since:
- 1.2
-
AssociationList
Constructs a List containing the elements of the specified collection, in the order they are returned by the collection's iterator.- Parameters:
strAssociationName- The name of the association. For instance "Columns".c- the collection whose elements are to be placed into this List.parentObj- The object this association belongs to.- Since:
- 1.2
-
-
Method Details
-
generateAssociationXML
public String generateAssociationXML(boolean fRequired, String callingObjectID) Create the XML string for this association list object -
generateAssociationAllXML
public String generateAssociationAllXML(boolean fRequired, String callingObjectID) Create the XML string for this association list object -
generateEmptyReplaceXML
public String generateEmptyReplaceXML()Generates a replacement XML String that is empty. -
generateAssociationWriteXML
public String generateAssociationWriteXML(boolean fRequired, String callingObjectID) Create the XML string for this association list object- Parameters:
fRequired- Is this association required for add.callingObjectID- the ID of the object calling this method.
-
generateObjectAndAssociationRemoveXML
public String generateObjectAndAssociationRemoveXML()Generates Function=Remove XML for this list -
updateObjectID
public void updateObjectID(String strOldId, String strNewId) Change the hash key associated with an object, and notify listeners- Parameters:
strOldId- StringstrNewId- String
-
removeOppositeAssn
Deprecated.REMOVED FROM API.Remove the parent object for the associationList on the other side of this association.- Parameters:
otherID- The object to get the associationList from.- Throws:
MdExceptionRemoteException
-
updateOppositeSideAssn
public void updateOppositeSideAssn()Updates the opposite side assn for all object currently in list -
setOppositeAssn
Deprecated.REMOVED FROM API.Sets the opposite side of the association.- Throws:
MdExceptionRemoteException
-
getOppositeAssn
Deprecated.REMOVED FROM API.Sets the opposite side of the association.- Throws:
MdExceptionRemoteException
-
getObjectIDs
public Vector<String> getObjectIDs()Returns the List of object ids in this list.- Returns:
- List of object id strings.
-
setObjectIDs
public void setObjectIDs(List<String> newIds) Sets the current list to be the new list.- Parameters:
newIds- Vector
-
getParent
Returns the parent object of this associationlist.- Returns:
- parent
-
setParent
Sets the parent object of this associationList.- Parameters:
inParent- CMetadata
-
setProperties
public void setProperties(String inProperties) Sets the properties of this association. This is a string of the form:
"010101"- Parameters:
inProperties- String
-
getProperties
public String getProperties() -
getAssociationName
public String getAssociationName()Gets the association Name -
getAssociationType
public String getAssociationType()Gets the associationType of this association- Returns:
- String
-
setAssociationType
public void setAssociationType(String type) Sets the associationType of this association- Parameters:
type- String
-
setIsPredAssoc
public void setIsPredAssoc(boolean ispred) Sets whether this is the pred side of the association or not.- Parameters:
ispred- boolean
-
getIsPredAssoc
public boolean getIsPredAssoc()Gets whether this is the pred side of the association or not- Returns:
- boolean
-
getMinCardinality
public String getMinCardinality()Get min cardinality for this association -
getMaxCardinality
public String getMaxCardinality()Get min cardinality for this association -
getIsRequired
public boolean getIsRequired()Is this association required for add. -
getDeletedItems
public List<String> getDeletedItems()Returns the deleted items or null if no deleted items. -
getState
public int getState()Returns a flag that tells if the user has added or removed items. -
setState
public void setState(int iValue) ORs the value with the existing state. -
setState
public void setState(int iValue, boolean AddToChangeIfChanged) ORs the value with the existing state. depending on existing state and passed in value.- Parameters:
iValue- new value to set state for.AddToChangeIfChanged- if true, add item to change list to be processed for write logic.
-
resetState
public void resetState(int iValue) Removes the value from the existing state. -
resetState
public void resetState(int iValue, boolean forceState) Removes the value from the existing state.- Parameters:
iValue- The value to set to, or to remove depending on forceState flagforceState- if true, force list state to be iValue, otherwise remove iValue from state.
-
isGoToServerForAssoc
public boolean isGoToServerForAssoc()Returns whether or not to go to the server to populate an association.- Returns:
- boolean
-
setSize
public void setSize(int newSize) Sets the size of this List. If the new size is greater than the current size, newnullitems are added to the end of the List. If the new size is less than the current size, all components at indexnewSizeand greater are discarded.- Parameters:
newSize- the new size of this List.- Throws:
ArrayIndexOutOfBoundsException- if new size is negative.
-
setElementAt
public void setElementAt(Object obj, int index) Sets the component at the specifiedindexof this List to be the specified object. The previous component at that position is discarded.The index must be a value greater than or equal to
0and less than the current size of the List.This method is identical in functionality to the set method (which is part of the List interface). Note that the set method reverses the order of the parameters, to more closely match array usage. Note also that the set method returns the old value that was stored at the specified position.
- Parameters:
obj- what the component is to be set to.index- the specified index.- Throws:
ArrayIndexOutOfBoundsException- if the index was invalid.- See Also:
-
removeElementAt
public void removeElementAt(int index) Deletes the component at the specified index. Each component in this List with an index greater or equal to the specifiedindexis shifted downward to have an index one smaller than the value it had previously. The size of this List is decreased by 1.The index must be a value greater than or equal to
0and less than the current size of the List.This method is identical in functionality to the remove method (which is part of the List interface). Note that the remove method returns the old value that was stored at the specified position.
- Parameters:
index- the index of the object to remove.- Throws:
ArrayIndexOutOfBoundsException- if the index was invalid.- See Also:
-
insertElementAt
public void insertElementAt(Object obj, int index) Inserts the specified object as a component in this List at the specifiedindex. Each component in this List with an index greater or equal to the specifiedindexis shifted upward to have an index one greater than the value it had previously.The index must be a value greater than or equal to
0and less than or equal to the current size of the List. (If the index is equal to the current size of the List, the new element is appended to the List.)This method is identical in functionality to the add(Object, int) method (which is part of the List interface). Note that the add method reverses the order of the parameters, to more closely match array usage.
- Parameters:
obj- the component to insert.index- where to insert the new component.- Throws:
ArrayIndexOutOfBoundsException- if the index was invalid.- See Also:
-
insertElementAt
public void insertElementAt(Object obj, int index, boolean objectModified) Inserts the specified object as a component in this List at the specifiedindex. Each component in this List with an index greater or equal to the specifiedindexis shifted upward to have an index one greater than the value it had previously.The index must be a value greater than or equal to
0and less than or equal to the current size of the List. (If the index is equal to the current size of the List, the new element is appended to the List.)This method is identical in functionality to the add(Object, int) method (which is part of the List interface). Note that the add method reverses the order of the parameters, to more closely match array usage.
- Parameters:
obj- the component to insert.index- where to insert the new component.- Throws:
ArrayIndexOutOfBoundsException- if the index was invalid.- See Also:
-
addElement
public void addElement(Object obj) Adds the specified component to the end of this List, increasing its size by one. The capacity of this List is increased if its size becomes greater than its capacity.This method is identical in functionality to the add(Object) method (which is part of the List interface).
- Parameters:
obj- the component to be added.- See Also:
-
removeElement
public boolean removeElement(Object obj) Removes the first (lowest-indexed) occurrence of the argument from this List. If the object is found in this List, each component in the List with an index greater or equal to the object's index is shifted downward to have an index one smaller than the value it had previously.This method is identical in functionality to the remove(Object) method (which is part of the List interface).
- Parameters:
obj- the component to be removed.- Returns:
trueif the argument was a component of this List;falseotherwise.- See Also:
-
removeElement
public boolean removeElement(Object obj, boolean processOtherSide) Removes the first (lowest-indexed) occurrence of the argument from this List. If the object is found in this List, each component in the List with an index greater or equal to the object's index is shifted downward to have an index one smaller than the value it had previously.This method is identical in functionality to the remove(Object) method (which is part of the List interface).
- Parameters:
obj- the component to be removed.- Returns:
trueif the argument was a component of this List;falseotherwise.- See Also:
-
removeAllElements
public void removeAllElements()Removes all components from this List and sets its size to zero.This method is identical in functionality to the clear method (which is part of the List interface).
- See Also:
-
removeAllElements
Removes all components from this List and sets its size to zero.This method is identical in functionality to the clear method (which is part of the List interface).
- Parameters:
objectChanged- does this remove change the containing object- Throws:
MdException- See Also:
-
set
public Object set(int index, Object obj) Replaces the element at the specified position in this List with the specified element.- Specified by:
setin interfaceList- Overrides:
setin classAbstractList- Parameters:
index- index of element to replace.obj- object to be stored at the specified position.- Returns:
- the element previously at the specified position.
- Throws:
ArrayIndexOutOfBoundsException- index out of range (index < 0 || index >= size()).IllegalArgumentException- fromIndex > toIndex.- Since:
- 1.2
-
add
protected boolean add(Object obj, int state) Deprecated.REMOVED FROM APIAppends the specified element to the end of this List.- Parameters:
obj- element to be appended to this List.state- state- Returns:
- true (as per the general contract of Collection.add).
- Since:
- 1.2
-
add
protected boolean add(Object obj, int state, boolean processOtherSideOfAssn) Deprecated.REMOVED FROM API.Appends the specified element to the end of this List.- Parameters:
obj- element to be appended to this List.state- state- Returns:
- true (as per the general contract of Collection.add).
- Since:
- 1.2
-
add
public boolean add(Object obj) Appends the specified element to the end of this List.- Specified by:
addin interfaceCollection- Specified by:
addin interfaceList- Overrides:
addin classAbstractList- Parameters:
o- element to be appended to this List.- Returns:
- true (as per the general contract of Collection.add).
- Since:
- 1.2
-
remove
public boolean remove(Object o) Removes the first occurrence of the specified element in this List If the List does not contain the element, it is unchanged. More formally, removes the element with the lowest index i such that(o==null ? get(i)==null : o.equals(get(i)))(if such an element exists).- Specified by:
removein interfaceCollection- Specified by:
removein interfaceList- Overrides:
removein classAbstractCollection- Parameters:
o- element to be removed from this List, if present.- Returns:
- true if the List contained the specified element.
- Since:
- 1.2
-
add
public void add(int index, Object 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).- Specified by:
addin interfaceList- Overrides:
addin classAbstractList- Parameters:
index- index at which the specified element is to be inserted.element- element to be inserted.- Throws:
ArrayIndexOutOfBoundsException- index is out of range (index < 0 || index > size()).- Since:
- 1.2
-
remove
public Object 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.- Specified by:
removein interfaceList- Overrides:
removein classAbstractList- Parameters:
index- the index of the element to removed.- Throws:
ArrayIndexOutOfBoundsException- index out of range (index < 0 || index >= size()).- Since:
- 1.2
-
getObjectforID
protected Object getObjectforID(String ID) Deprecated.REMOVED FROM APIGet the object for and ID- Parameters:
ID- The id to get the object for recursively in parent's store.- Returns:
- the object that exists in owning objects store for ID.
-
getObjectforID
protected Object getObjectforID(String ID, boolean hashOnly) Deprecated.REMOVED FROM APIGet the object for and ID- Parameters:
ID- The id to get the object for recursively in parent's store.use- parents map of objects to look only...not recursive.- Returns:
- the object that exists in owning objects store for ID.
-
addAll
public boolean addAll(Collection c) 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. The behavior of this operation is undefined if the specified Collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified Collection is this List, and this List is nonempty.)- Specified by:
addAllin interfaceCollection- Specified by:
addAllin interfaceList- Overrides:
addAllin classAbstractCollection- Parameters:
c- elements to be inserted into this List.- Throws:
ArrayIndexOutOfBoundsException- index out of range (index < 0 || index > size()).- Since:
- 1.2
-
removeAll
public boolean removeAll(Collection c) Removes from this List all of its elements that are contained in the specified Collection.- Specified by:
removeAllin interfaceCollection- Specified by:
removeAllin interfaceList- Overrides:
removeAllin classAbstractCollection- Returns:
- true if this List changed as a result of the call.
- Since:
- 1.2
-
retainAll
public boolean retainAll(Collection c) 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.- Specified by:
retainAllin interfaceCollection- Specified by:
retainAllin interfaceList- Overrides:
retainAllin classAbstractCollection- Returns:
- true if this List changed as a result of the call.
- Since:
- 1.2
-
addAll
public boolean addAll(int index, Collection c) Inserts all of the elements in in the specified Collection into this List at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the List in the order that they are returned by the specified Collection's iterator.- Specified by:
addAllin interfaceList- Overrides:
addAllin classAbstractList- Parameters:
index- index at which to insert first element from the specified collection.c- elements to be inserted into this List.- Throws:
ArrayIndexOutOfBoundsException- index out of range (index < 0 || index > size()).- Since:
- 1.2
-
removeRange
protected void removeRange(int fromIndex, int toIndex) Deprecated.REMOVED FROM APIRemoves from this List all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive. Shifts any succeeding elements to the left (reduces their index). This call shortens the ArrayList by (toIndex - fromIndex) elements. (If toIndex==fromIndex, this operation has no effect.)- Overrides:
removeRangein classAbstractList- Parameters:
fromIndex- index of first element to be removed.toIndex- index after last element to be removed.
-
flushAll
public void flushAll()Use this to empty out the list in preperation for deleting it -
iterator
public Iterator iterator()Returns an iterator over the elements in this list in proper sequence.This implementation returns a straightforward implementation of the iterator interface, relying on the backing list's size(), get(int), and remove(int) methods.
Note that the iterator returned by this method will throw an UnsupportedOperationException in response to its remove method unless the list's remove(int) method is overridden.
This implementation can be made to throw runtime exceptions in the face of concurrent modification, as described in the specification for the (protected) modCount field.
- Specified by:
iteratorin interfaceCollection- Specified by:
iteratorin interfaceIterable- Specified by:
iteratorin interfaceList- Overrides:
iteratorin classAbstractList- Returns:
- an iterator over the elements in this list in proper sequence.
- See Also:
-
listIterator
public ListIterator listIterator()Returns an iterator of the elements in this list (in proper sequence). This implementation returns listIterator(0).- Specified by:
listIteratorin interfaceList- Overrides:
listIteratorin classAbstractList- Returns:
- an iterator of the elements in this list (in proper sequence).
- See Also:
-
listIterator
public ListIterator listIterator(int index) Returns a list iterator of 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 the next method. An initial call to the previous method would return the element with the specified index minus one.This implementation returns a straightforward implementation of the ListIterator interface that extends the implementation of the Iterator interface returned by the iterator() method. The ListIterator implementation relies on the backing list's get(int), set(int, Object), add(int, Object) and remove(int) methods.
Note that the list iterator returned by this implementation will throw an UnsupportedOperationException in response to its remove, set and add methods unless the list's remove(int), set(int, Object), and add(int, Object) methods are overridden.
This implementation can be made to throw runtime exceptions in the face of concurrent modification, as described in the specification for the (protected) modCount field.
- Specified by:
listIteratorin interfaceList- Overrides:
listIteratorin classAbstractList- Parameters:
index- index of the first element to be returned from the list iterator (by a call to the next method).- Returns:
- a list iterator of the elements in this list (in proper sequence), starting at the specified position in the list.
- Throws:
IndexOutOfBoundsException- if the specified index is out of range (index < 0 || index > size()).- See Also:
-
contains
public boolean contains(Object obj) Tests if the specified object is a component in this List.- Specified by:
containsin interfaceCollection- Specified by:
containsin interfaceList- Overrides:
containsin classAbstractCollection- Parameters:
elem- an object.- Returns:
trueif and only if the specified object is the same as a component in this List, as determined by the equals method;falseotherwise.
-
containsAll
public boolean containsAll(Collection c) Returns true if this List contains all of the elements in the specified Collection.- Specified by:
containsAllin interfaceCollection- Specified by:
containsAllin interfaceList- Overrides:
containsAllin classAbstractCollection- Returns:
- true if this List contains all of the elements in the specified collection.
-
copyInto
public void copyInto(Object[] anArray) Copies the components of this List into the specified array. The item at index k in this List is copied into component k of anArray. The array must be big enough to hold all the objects in this List, else an IndexOutOfBoundsException is thrown.- Parameters:
anArray- the array into which the components get copied.
-
dispose
public void dispose()Clears object and all memory used by object. -
elementAt
public Object elementAt(int index) Returns the component at the specified index.This method is identical in functionality to the get method (which is part of the List interface).
- Parameters:
index- an index into this List.- Returns:
- the component at the specified index.
- Throws:
ArrayIndexOutOfBoundsException- if the index is negative or not less than the current size of this List object. given.- See Also:
-
elements
public Enumeration elements()Returns an enumeration of the components of this List. The returned Enumeration object will generate all items in this List. The first item generated is the item at index 0, then the item at index 1, and so on.- Returns:
- an enumeration of the components of this List.
- See Also:
-
ensureCapacity
public void ensureCapacity(int minCapacity) Increases the capacity of this List, if necessary, to ensure that it can hold at least the number of components specified by the minimum capacity argument.If the current capacity of this List is less than minCapacity, then its capacity is increased by replacing its internal data array, kept in the field elementData, with a larger one. The size of the new data array will be the old size plus capacityIncrement, unless the value of capacityIncrement is less than or equal to zero, in which case the new capacity will be twice the old capacity; but if this new size is still smaller than minCapacity, then the new capacity will be minCapacity.
- Parameters:
minCapacity- the desired minimum capacity.
-
firstElement
public Object firstElement()Returns the first component (the item at index 0) of this List.- Returns:
- the first component of this List.
- Throws:
NoSuchElementException- if this List has no components.
-
get
public Object get(int index) Returns the element at the specified position in this List.- Specified by:
getin interfaceList- Specified by:
getin classAbstractList- Parameters:
index- index of element to return.- Throws:
ArrayIndexOutOfBoundsException- index is out of range (index < 0 || index >= size()).- Since:
- 1.2
-
hashCode
public int hashCode()Returns the hash code value for this List.- Specified by:
hashCodein interfaceCollection- Specified by:
hashCodein interfaceList- Overrides:
hashCodein classAbstractList
-
indexOf
public int indexOf(Object elem) Searches for the first occurence of the given argument, testing for equality using theequalsmethod.- Specified by:
indexOfin interfaceList- Overrides:
indexOfin classAbstractList- Parameters:
elem- an object.- Returns:
- the index of the first occurrence of the argument in this
List, that is, the smallest value k such that
elem.equals(elementData[k]) is true;
returns
-1if the object is not found. - See Also:
-
indexOf
public int indexOf(Object elem, int index) Searches for the first occurence of the given argument, beginning the search atindex, and testing for equality using theequalsmethod.- Parameters:
elem- an object.index- the non-negative index to start searching from.- Returns:
- the index of the first occurrence of the object argument in
this List at position
indexor later in the List, that is, the smallest value k such that elem.equals(elementData[k]) && (k >= index) is true; returns-1if the object is not found. (Returns-1if index >= the current size of this List.) - Throws:
IndexOutOfBoundsException- if index is negative.- See Also:
-
isEmpty
public boolean isEmpty()Tests if this List has no components.- Specified by:
isEmptyin interfaceCollection- Specified by:
isEmptyin interfaceList- Overrides:
isEmptyin classAbstractCollection- Returns:
trueif and only if this List has no components, that is, its size is zero;falseotherwise.
-
lastElement
public Object lastElement()Returns the last component of the List.- Returns:
- the last component of the List, i.e., the component at index
size() - 1. - Throws:
NoSuchElementException- if this List is empty.
-
lastIndexOf
public int lastIndexOf(Object elem) Returns the index of the last occurrence of the specified object in this List.- Specified by:
lastIndexOfin interfaceList- Overrides:
lastIndexOfin classAbstractList- Parameters:
elem- the desired component.- Returns:
- the index of the last occurrence of the specified object in
this List, that is, the largest value k such that
elem.equals(elementData[k]) is true;
returns
-1if the object is not found.
-
lastIndexOf
public int lastIndexOf(Object elem, int index) Searches backwards for the specified object, starting from the specified index, and returns an index to it.- Parameters:
elem- the desired component.index- the index to start searching from.- Returns:
- the index of the last occurrence of the specified object in this
List at position less than or equal to
indexin the List, that is, the largest value k such that elem.equals(elementData[k]) && (k <= index) is true;-1if the object is not found. (Returns-1if index is negative.) - Throws:
IndexOutOfBoundsException- if index is greater than or equal to the current size of this List.
-
size
public int size()Returns the number of components in this List.- Specified by:
sizein interfaceCollection- Specified by:
sizein interfaceList- Specified by:
sizein classAbstractCollection- Returns:
- the number of components in this List.
-
subList
Returns a view of the portion of this List between fromIndex, inclusive, and toIndex, exclusive. (If fromIndex and ToIndex are equal, the returned List is empty.) The returned List is backed by this List, so changes in the returned List are reflected in this List, and vice-versa. The returned List supports all of the optional List operations supported by this List.This method eliminates the need for explicit range operations (of the sort that commonly exist for arrays). Any operation that expects a List can be used as a range operation by operating on a subList view instead of a whole List. For example, the following idiom removes a range of elements from a List:
list.subList(from, to).clear();Similar idioms may be constructed for indexOf and lastIndexOf, and all of the algorithms in the Collections class can be applied to a subList.The semantics of the List returned by this method become undefined if the backing list (i.e., this List) is structurally modified in any way other than via the returned List. (Structural modifications are those that change the size of the List, or otherwise perturb it in such a fashion that iterations in progress may yield incorrect results.)
- Specified by:
subListin interfaceList- Overrides:
subListin classAbstractList- Parameters:
fromIndex- low endpoint (inclusive) of the subList.toIndex- high endpoint (exclusive) of the subList.- Returns:
- a view of the specified range within this List.
- Throws:
IndexOutOfBoundsException- endpoint index value out of range(fromIndex < 0 || toIndex > size)IllegalArgumentException- endpoint indices out of order(fromIndex > toIndex)
-
toArray
public Object[] toArray()Returns an array containing all of the elements in this List in the correct order.- Specified by:
toArrayin interfaceCollection- Specified by:
toArrayin interfaceList- Overrides:
toArrayin classAbstractCollection- Since:
- 1.2
-
toArray
public Object[] toArray(Object[] a) Returns an array containing all of the elements in this List in the correct order. The runtime type of the returned array is that of the specified array. If the List fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this List.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 List 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.
- Specified by:
toArrayin interfaceCollection- Specified by:
toArrayin interfaceList- Overrides:
toArrayin classAbstractCollection- Parameters:
a- the array into which the 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.- Returns:
- an array containing the elements of the List.
- Throws:
ArrayStoreException- the runtime type of a is not a supertypeRuntimeException- is thrown if RemoteException is encountered(RemoteException is chained) of the runtime type of every element in this List.
-
toString
public String toString()Returns a string representation of this collection. The string representation consists of a list of the collection's elements in the order they are returned by its iterator, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (comma and space). Elements are converted to strings as by String.valueOf(Object).This implementation creates an empty string buffer, appends a left square bracket, and iterates over the collection appending the string representation of each element in turn. After appending each element except the last, the string ", " is appended. Finally a right bracket is appended. A string is obtained from the string buffer, and returned.
- Overrides:
toStringin classAbstractCollection- Returns:
- a string representation of this collection.
-
trimToSize
public void trimToSize()Trims the capacity of this List to be the List's current size. If the capacity of this cector is larger than its current size, then the capacity is changed to equal the size by replacing its internal data array, kept in the field elementData, with a smaller one. An application can use this operation to minimize the storage of a List. -
getInternalListObject
public MdObjectList getInternalListObject()
-