T - object object of the type user specifies at the time of instantiation of this interfacepublic class SingleCollection<T> extends java.lang.Object implements ISingleCollection<T>
| Modifier and Type | Class and Description |
|---|---|
class |
SingleCollection.CollectionIterator
An CollectionIterator for collection that allows the programmer to traverse the collection in either direction,
modify the collection during iteration.
|
| Constructor and Description |
|---|
SingleCollection()
Construct instance of SingleCollection
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T objT)
This method provides a mechanism for adding an elemtn to the collection
|
void |
clear()
Removes all of the elements from this SingleCollection.
|
boolean |
contains(T objT)
This method returns the status indicating whether the element is present in the collection or not
|
T |
elementAt(int index)
This method returns the element at the index from the collection specified by the user
|
T |
get(int index)
This method provides index based accessing over the internal collection
|
boolean |
isEmpty()
The implementation of this method checks that either collection is null or empty.
|
ICollectionIterator<T> |
iterator()
This method returns an iterator over the internal collection
|
void |
remove(int iIndex)
Removes the element at the specified index.
|
void |
remove(T objT)
Removes the element specified from the collection.
|
int |
size()
This method returns the size of the collection
|
T[] |
toArray()
This method returns array of the objects in the collection
|
public SingleCollection()
public ICollectionIterator<T> iterator()
iterator in interface ICollectionIterable<T>iterator in interface java.lang.Iterable<T>public boolean add(T objT)
add in interface ISingleCollection<T>objT - the element to insert.public boolean contains(T objT)
contains in interface ISingleCollection<T>objT - the element to insert.public T get(int index)
get in interface ISingleCollection<T>index - This parameter specifies the index of the element to be retrievedpublic int size()
size in interface ISingleCollection<T>public boolean isEmpty()
isEmpty in interface ISingleCollection<T>public T elementAt(int index)
elementAt in interface ISingleCollection<T>index - index specifying the position of the element in the collectionpublic T[] toArray()
toArray in interface ISingleCollection<T>public void remove(int iIndex)
remove in interface ISingleCollection<T>iIndex - - position of the element.public void remove(T objT)
remove in interface ISingleCollection<T>objT - - element to be removed.public void clear()
clear in interface ISingleCollection<T>