java.lang.Object | |
↳ | com.microstrategy.utils.SimpleListObj |
This class will allow the user to add, remove, and examine the objects in the given collection.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
SimpleListObj() | |||||||||||
SimpleListObj(Class objectAllowed) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
add(Object element)
Adds the given object to the collection.
| ||||||||||
void |
addAll(SimpleList simpleList)
Adds all elements in another
SimpleList into this list. | ||||||||||
void |
clear()
Clears all items from the collection.
| ||||||||||
Collection | collection() | ||||||||||
boolean |
contains(Object item)
Returns whether a specific object is contained in the collection.
| ||||||||||
Enumeration |
elements()
Return the enumeration of the items inside this list.
| ||||||||||
Class |
getObjectTypeAllowed()
Returns the object type allowed in the collection.
| ||||||||||
boolean |
isEmpty()
Returns true if the collection is empty, false otherwise.
| ||||||||||
boolean |
isReadOnly()
Returns true if the collection is read-only, false if it can be modified.
| ||||||||||
Object |
item(int index)
Returns the item in the list with the given index.
| ||||||||||
void |
remove(int index)
Removes the item with the given index from the list.
| ||||||||||
boolean |
remove(Object obj)
Removes the specified object from the collection.
| ||||||||||
void |
setObjectTypeAllowed(Class _typeAllowed)
Sets the object type allowed in the collection.
| ||||||||||
void |
setReadOnly(boolean isReadOnly)
Sets the collection as read-only.
| ||||||||||
int |
size()
Returns the current size of the list.
| ||||||||||
void |
sort(Comparator c)
Sorts the collection using the specified Comparator.
| ||||||||||
ArrayList |
toArrayList()
Return the list as an array list.
| ||||||||||
String | toString() |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Adds the given object to the collection. It will be added to the end of the list. Note that this could fail either because the object is read-only, or because the creating object has constrained the list to only hold a certain type of object.
element | The object to add to the collection. |
---|
UnsupportedOperationException | Thrown if the list is read-only. |
---|---|
ClassCastException | Thrown if the object given is of an inappropriate type. |
Adds all elements in another SimpleList
into this list.
simpleList | The list whose elements will be added into this list. |
---|
Clears all items from the collection. Throws an UnsupportedOperationException if the object is read-only.
UnsupportedOperationException | Thrown if the list is read-only. |
---|
Returns whether a specific object is contained in the collection.
item | The object we want to search in the collection. |
---|
true
when the item
is contained in the collection. Otherwise, false
will be returned.
Return the enumeration of the items inside this list.
Returns the object type allowed in the collection.
Returns true if the collection is empty, false otherwise.
Returns true if the collection is read-only, false if it can be modified.
Returns the item in the list with the given index.
index | The index of the item in the collection to return. |
---|
IndexOutOfBoundsException | Thrown if no item in the collection has the given index. |
---|
Removes the item with the given index from the list. This will cause a shifting of indices of items in the list which are after the removed item.
index | The index of the item in the collection to remove. |
---|
IndexOutOfBoundsException | Thrown if no item in the collection has the given index. |
---|---|
UnsupportedOperationException | Thrown if the list is designated as read-only. |
Removes the specified object from the collection.
obj | The object to be removed. |
---|
true
if the object has been successfully removed. Otherwise, false
will be
returned.UnsupportedOperationException | Thrown when this collection is read-only. |
---|
Sets the object type allowed in the collection.
_typeAllowed | the object type allowed in the collection. |
---|
Sets the collection as read-only.
isReadOnly | whether the collection will be read only or not. |
---|
Returns the current size of the list.
Sorts the collection using the specified Comparator.
c | The Comparator to be used in sorting. |
---|
Return the list as an array list.