Package net.sf.okapi.lib.xliff2.core
Class BaseList<T>
- java.lang.Object
-
- net.sf.okapi.lib.xliff2.core.BaseList<T>
-
- Type Parameters:
T- the type of item for this list (e.g. Note, Match, etc.).
- All Implemented Interfaces:
Iterable<T>
- Direct Known Subclasses:
ChangeTrack,Glossary,Matches,Metadata,MetaGroup,Notes,Revision,Revisions,Validation
public abstract class BaseList<T> extends Object implements Iterable<T>
Provides the common methods for accessing and manipulating list-type objects such as the notes, the extension attributes, glossary, etc. Classes used as the type for theBaseListmust be supported in theCloneFactory.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tadd(T object)Adds an object to this list.voidclear()Removes all objects in this list.Tget(int index)Gets the object at a given index position.booleanisEmpty()Indicates if this list is empty.Iterator<T>iterator()voidremove(int index)Removes from this list the object at the given index position.voidremove(T object)Removes a given object from this list.Tset(int index, T object)Replaces an existing object by a new one at a given index position.intsize()Gets the number of objects in this list.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
size
public int size()
Gets the number of objects in this list.- Returns:
- the number of objects in this list.
-
isEmpty
public boolean isEmpty()
Indicates if this list is empty.- Returns:
- true if there is no object in this list, false if there is one or more.
-
clear
public void clear()
Removes all objects in this list.
-
add
public T add(T object)
Adds an object to this list.- Parameters:
object- the object to add.- Returns:
- the object that was added.
-
remove
public void remove(int index)
Removes from this list the object at the given index position.- Parameters:
index- the index position.- Throws:
IndexOutOfBoundsException- if the index is invalid.
-
remove
public void remove(T object)
Removes a given object from this list. If the object is not in the list nothing changes.- Parameters:
object- the object to remove.
-
get
public T get(int index)
Gets the object at a given index position.- Parameters:
index- the index position.- Returns:
- the object at the given index.
- Throws:
IndexOutOfBoundsException- if the index is invalid.
-
set
public T set(int index, T object)
Replaces an existing object by a new one at a given index position.- Parameters:
index- the index position.object- the new object to set.- Returns:
- the object that was set.
- Throws:
IndexOutOfBoundsException- if the index is invalid.
-
-