com.sas.util
Interface Enumerator

All Superinterfaces:
java.util.Enumeration

public interface Enumerator
extends java.util.Enumeration

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 nextElement() after calling finish().


Method Summary
 Enumerator finish()
          Call finish() if you are finished with the Enumerator before exhausting it.
 

Method Detail

finish

Enumerator finish()
Call 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.

Returns:
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.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.