T - an extension of AnnotatedEntitypublic class AnnotatedEntityList<T extends AnnotatedEntity> extends Object
AnnotatedEntitys where
elements can be accessed either by index or by the name
of the AnnotatedEntity.| Constructor and Description |
|---|
AnnotatedEntityList()
Creates a new
AnnotatedEntityList with an initial
capacity of 10. |
AnnotatedEntityList(int initialCapacity)
Creates a new
AnnotatedEntityList with given initial
capacity. |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int idx,
T entity)
|
void |
add(T... entities)
Adds all
AnnotatedEntitys in entities
to the list. |
void |
addAll(Collection<? extends T> entities)
Adds all
AnnotatedEntitys in entities
to the list. |
T |
get(int index)
Returns the
AnnotatedEntity at index index
in the list. |
T |
get(String name)
Returns the
AnnotatedEntity with name name
in the list. |
String[] |
getNames()
Returns the names of all
AnnotatedEntitys in the list. |
T |
remove(int idx)
Removes and returns the
AnnotatedEntity at index idx. |
void |
set(int idx,
T entity)
|
int |
size()
Returns the number of
AnnotatedEntitys (not the capacity)
in the AnnotatedEntityList. |
<E extends T> |
toArray(E[] ar)
Returns the
AnnotatedEntitys in this list
as an array. |
public AnnotatedEntityList()
AnnotatedEntityList with an initial
capacity of 10.public AnnotatedEntityList(int initialCapacity)
AnnotatedEntityList with given initial
capacity.initialCapacity - the initial capacitypublic void set(int idx,
T entity)
idx - the indexentity - the new AnnotatedEntity at index idxpublic T remove(int idx)
AnnotatedEntity at index idx.idx - the index of the AnnotatedEntity to be removedAnnotatedEntity that has been at index idxpublic void add(int idx,
T entity)
AnnotatedEntity entity
at index idx to the list. If entities contains AnnotatedEntitys with duplicate names,
or an AnnotatedEntity with identical name already exists in the list,
an IllegalArgumentException is thrown.idx - the indexentity - the added AnnotatedEntityList.add(int, Object)public void add(T... entities)
AnnotatedEntitys in entities
to the list. If entities contains AnnotatedEntitys with duplicate names,
or an AnnotatedEntity with identical name already exists in the list,
an IllegalArgumentException is thrown.entities - the added AnnotatedEntitypublic void addAll(Collection<? extends T> entities)
AnnotatedEntitys in entities
to the list. If entities contains AnnotatedEntitys with duplicate names,
or an AnnotatedEntity with identical name already exists in the list,
an IllegalArgumentException is thrown.entities - the added AnnotatedEntitypublic T get(int index)
AnnotatedEntity at index index
in the list.index - the indexAnnotatedEntity at indexpublic T get(String name)
AnnotatedEntity with name name
in the list.name - the nameAnnotatedEntity with name nameAnnotatedEntity.getName()public int size()
AnnotatedEntitys (not the capacity)
in the AnnotatedEntityList.AnnotatedEntityspublic String[] getNames()
AnnotatedEntitys in the list.AnnotatedEntity.getName()public <E extends T> E[] toArray(E[] ar)
AnnotatedEntitys in this list
as an array. This method behaves exactly like ArrayList.toArray(Object[]).E - a sub-type of AnnotatedEntityar - an array of the desired typeAnnotatedEntitys in this list as an array