public class Collection<T>
extends java.lang.Object
implements java.lang.Iterable<T>
Constructor and Description |
---|
Collection()
Initializes a new instance of the Collection<> class that is empty.
|
Collection(java.util.List<T> list)
Initializes a new instance of the Collection<> class as a wrapper for the specified list.
|
Modifier and Type | Method and Description |
---|---|
void |
Add(T item)
Adds an object to the end of the Collection<>.
|
void |
Clear()
Removes all elements from the Collection<>.
|
protected void |
ClearItems()
Removes all elements from the Collection<>.
|
int |
Count()
Gets the number of elements actually contained in the System.Collections.ObjectModel.Collection
|
T |
get(int index)
Gets the element at the specified index.
|
protected java.util.List<T> |
getItems()
Gets a java.util.List
|
int |
IndexOf(T item)
Searches for the specified object and returns the zero-based index of the first occurrence within the entire Collection<>.
|
void |
Insert(int index,
T item)
Inserts an element into the Collection<> at the specified index.
|
protected void |
InsertItem(int index,
T item)
Inserts an element into the Collection<> at the specified index.
|
java.util.Iterator<T> |
iterator() |
boolean |
Remove(T item) |
protected void |
RemoveItem(int index)
Removes the element at the specified index of the Collection<>.
|
void |
set(int index,
T item)
Sets the element at the specified index.
|
protected void |
SetItem(int index,
T item)
Replaces the element at the specified index.
|
public Collection()
public Collection(java.util.List<T> list)
list
- The list that is wrapped by the new collection.public int Count()
protected java.util.List<T> getItems()
public T get(int index)
index
- The zero-based index of the element to get.public void set(int index, T item)
index
- The zero-based index of the element to set.item
- The new value for the element at the specified index. The value can be null for reference types.public void Add(T item)
item
- The object to be added to the end of the Collection<>. The value can be null for reference types.public java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T>
public void Clear()
protected void ClearItems()
public int IndexOf(T item)
item
- The object to locate in the List<>. The value can be null for reference types.public void Insert(int index, T item)
index
- The object to insert. The value can be null for reference types.item
- The zero-based index at which item should be inserted.protected void InsertItem(int index, T item)
index
- The object to insert. The value can be null for reference types.item
- The zero-based index at which item should be inserted.public boolean Remove(T item)
item
- protected void RemoveItem(int index)
index
- The zero-based index of the element to remove.protected void SetItem(int index, T item)
index
- The zero-based index of the element to replace.item
- The new value for the element at the specified index. The value can be null for reference types.