|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||
public interface Enumerator
An Enumerator is an java.lang.Enumeration
which also has a method to mark the enumerator as
finished.
You will probably get a NullPointerException
if you invoke after calling nextElement().
finish()
| Method Summary | |
|---|---|
Enumerator |
finish()
Call finish() if you are finished
with the Enumerator before exhausting it. |
| Method Detail |
|---|
Enumerator finish()
finish() if you are finished
with the Enumerator before exhausting it. For example,
if you are using an Enumerator to search a collection
for an item and find it before hitting the
enumerator.hasMoreElements() == false
condition, then you should call finish() so that
the enumerator can perform some cleanup.
null, so that you can set a reference to null and mark
it as finished with one statement:
enum = enum.finish();
This allows the Enumerator
to be garbage collected sooner.
|
| Components |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||