org.openide.util.enum
Class FilterEnumeration
java.lang.Object
|
+--org.openide.util.enum.FilterEnumeration
- All Implemented Interfaces:
- Enumeration
- Direct Known Subclasses:
- RemoveDuplicatesEnumeration
- public class FilterEnumeration
- extends Object
- implements Enumeration
Abstract class that takes an enumeration and filters its elements.
To get this class fully work one must override accept
method.
Objects in the enumeration must not be null
.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FilterEnumeration
public FilterEnumeration(Enumeration en)
- Parameters:
en
- enumeration to filter
accept
protected boolean accept(Object o)
- Filters objects. Overwrite this to decide which objects should be
included in enumeration and which not.
Default implementation accepts all non-null objects
- Parameters:
o
- the object to decide on- Returns:
- true if it should be in enumeration and false if it should not
hasMoreElements
public boolean hasMoreElements()
- Specified by:
hasMoreElements
in interface Enumeration
- Returns:
- true if there is more elements in the enumeration
nextElement
public Object nextElement()
- Specified by:
nextElement
in interface Enumeration
- Returns:
- next object in the enumeration
- Throws:
NoSuchElementException
- can be thrown if there is no next object
in the enumeration
Built on December 12 2001. | Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.