com.togethersoft.openapi.util.enum
Class OrderedMergerEnumeration
- public class OrderedMergerEnumeration
- implements Enumeration
Represents enumeration which built from two others. This enumeration contains ordered merge from first and
second source enumerations. For example: first={1,3,5}, second={2,4,6}, result={1,2,3,4,5,6}. For comparing
used class which has to implement java.util.Comparator interface. It is possible to specify whether to allow
dublicates in this enumeration or not.
- Author:
- TogetherSoft
| Constructor Summary |
OrderedMergerEnumeration(Enumeration first, Enumeration second, Comparator comparator, boolean allowDuplicates) Initialize new OrderedMergerEnumeration. |
OrderedMergerEnumeration(Enumeration first, Enumeration second, Comparator comparator) Initialize new OrderedMergerEnumeration. |
| Method Summary |
boolean | hasMoreElements() Checks are there more elements in this enumeration. |
Object | nextElement() Returns next element from this merged enumeration. |
OrderedMergerEnumeration
public OrderedMergerEnumeration(Enumeration first, Enumeration second, Comparator comparator, boolean allowDuplicates)
- Initialize new OrderedMergerEnumeration.
- Parameters:
- first - First source enumeration; merging will be started from this
- second - Second source enumeration
- comparator - Object of class which implements java.util.Comparator interface
- allowDuplicates - Specifies whether dublicated elements are allowed or not
OrderedMergerEnumeration
public OrderedMergerEnumeration(Enumeration first, Enumeration second, Comparator comparator)
- Initialize new OrderedMergerEnumeration. Dublicated elements are not allowed.
- Parameters:
- first - First source enumeration; merging will be started from this
- second - Second source enumeration
- comparator - Object of class which implements java.util.Comparator interface
hasMoreElements
public boolean hasMoreElements()
- Checks are there more elements in this enumeration.
nextElement
public Object nextElement()
- Returns next element from this merged enumeration.
to Class java.util.Comparator