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

hudson.util.AdaptedIterator Maven / Gradle / Ivy

The newest version!
/*******************************************************************************
 *
 * Copyright (c) 2004-2009 Oracle Corporation.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors: 
*
*    Kohsuke Kawaguchi
 *     
 *
 *******************************************************************************/ 

package hudson.util;

import java.util.Iterator;

/**
 * {@link Iterator} that adapts the values returned from another iterator.
 *
 * 

* This class should be really in {@link Iterators} but for historical reasons it's here. * * @author Kohsuke Kawaguchi * @since 1.121 * @see Iterators */ public abstract class AdaptedIterator implements Iterator { private final Iterator core; protected AdaptedIterator(Iterator core) { this.core = core; } protected AdaptedIterator(Iterable core) { this(core.iterator()); } public boolean hasNext() { return core.hasNext(); } public U next() { return adapt(core.next()); } protected abstract U adapt(T item); public void remove() { core.remove(); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy