java.lang.Object
de.elo.utils.webapp.status.StatusData.DataList<T>
Type Parameters:
T
- Info, Action or Property
All Implemented Interfaces:
java.lang.Iterable<T>
Direct Known Subclasses:
StatusData.Actions
, StatusData.Infos
, StatusData.Properties
Enclosing class:
StatusData
public static class StatusData.DataList<T>
extends java.lang.Object
implements java.lang.Iterable<T>
This class defines a collection that can be constrained to a maximum number of items.
If the maximum number of items is exceeded, the oldes item in the list is removed.
Field Summary
Fields
Modifier and Type
Field
Description
protected java.util.List<T >
list
Internally used list
protected int
maxSize
Maximum number of Elements
Constructor Summary
Constructors
Constructor
Description
DataList (int maxSize)
Constructor
DataList (java.util.List<T > list)
Constructor.
Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type
Method
Description
StatusData.DataList <T >
add (T t)
Add an item to the list.
void
clear ()
Deletes all items in the list.
java.util.Iterator<T >
iterator ()
Retuns an iterator on the 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
Field Details
protected int maxSize
Maximum number of Elements
protected java.util.List<T > list
Internally used list
Constructor Details
public DataList (int maxSize)
Constructor
Parameters:
maxSize
- Maximum number of items.
public DataList (
java.util.List<T > list)
Constructor.
Parameters:
list
- This object is used as the internal list of items.
Method Details
Add an item to the list.
Parameters:
t
- item
public java.util.Iterator<T > iterator ()
Retuns an iterator on the list.
To avoid synchronisation problems, the returned iterator belongs to a copy of the list.
Specified by:
iterator
in interface java.lang.Iterable<T >
Returns:
iterator
public void clear ()
Deletes all items in the list.