public class TLcdFinalizedEnumeration extends Object implements ILcdAutoCloseableEnumeration
Enumeration
, and performs a given action after
having returned the last element.
Example application: when an Enumeration
returns data from a file, the
finalizing action can close the file at the end. This way the consumer
of the data does not have to be aware of the data source.
Constructor and Description |
---|
TLcdFinalizedEnumeration(Enumeration aEnumeration,
ILcdFinalizeAction aFinalizeAction)
Constructs a new
Enumeration that is identical to the given Enumeration ,
but in addition it performs the given action after having returned the
last element. |
Modifier and Type | Method and Description |
---|---|
void |
close()
This close method does not throw checked exceptions.
|
boolean |
hasMoreElements()
Implements
Enumeration.hasMoreElements() . |
Object |
nextElement()
Implements
Enumeration.nextElement() . |
public TLcdFinalizedEnumeration(Enumeration aEnumeration, ILcdFinalizeAction aFinalizeAction)
Enumeration
that is identical to the given Enumeration
,
but in addition it performs the given action after having returned the
last element.aEnumeration
- the Enumeration
that will be returned.aFinalizeAction
- the action that is performed at the end.public boolean hasMoreElements()
Enumeration.hasMoreElements()
.hasMoreElements
in interface Enumeration
public Object nextElement()
Enumeration.nextElement()
.nextElement
in interface Enumeration
public void close()
ILcdAutoCloseableEnumeration
close
in interface ILcdAutoCloseableEnumeration
close
in interface AutoCloseable