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

ucar.nc2.ft.point.CollectionIteratorAdapter Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 1998-2018 John Caron and University Corporation for Atmospheric Research/Unidata
 * See LICENSE for license information.
 */
package ucar.nc2.ft.point;

import ucar.nc2.ft.PointFeatureCollectionIterator;

import java.io.IOException;
import java.util.Iterator;

/**
 * adapt a PointFeatureCollectionIterator to an Iterator
 *
 * @author caron
 * @since 9/24/2015.
 */
public class CollectionIteratorAdapter implements Iterator {
    PointFeatureCollectionIterator pfIterator;

    public CollectionIteratorAdapter(PointFeatureCollectionIterator pfIterator) {
      this.pfIterator = pfIterator;
    }

    @Override
    public boolean hasNext() {
      try {
        return pfIterator.hasNext();
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }

    @Override
    public T next() {
      try {
        return (T) pfIterator.next();
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy