All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jhotdraw8.collection.enumerator.AbstractEnumerator Maven / Gradle / Ivy

The newest version!
/*
 * @(#)AbstractSpliterator.java
 * Copyright © 2023 The authors and contributors of JHotDraw. MIT License.
 */
package org.jhotdraw8.collection.enumerator;

import java.util.Spliterator;
import java.util.Spliterators;

/**
 * Abstract base classes for {@link Enumerator}s.
 * 

* Subclasses should only implement the {@link Enumerator#moveNext()} * method and (optionally) the {@link Spliterator#trySplit()} method: *

 *     public boolean moveNext() {
 *         if (...end not reached...) {
 *             current = ...;
 *             return true;
 *         }
 *         return false;
 *     }
 * 
* * @param the element type */ public abstract class AbstractEnumerator extends Spliterators.AbstractSpliterator implements Enumerator { /** * The current element of the enumerator. */ protected E current; /** * Creates a spliterator reporting the given estimated size and * additionalCharacteristics. * * @param est the estimated size of this spliterator if known, otherwise * {@code Long.MAX_VALUE}. * @param additionalCharacteristics properties of this spliterator's * source or elements. If {@code SIZED} is reported then this * spliterator will additionally report {@code SUBSIZED}. */ protected AbstractEnumerator(long est, int additionalCharacteristics) { super(est, additionalCharacteristics); } /** * {@inheritDoc} */ @Override public E current() { return current; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy