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

org.simpleflatmapper.util.TransformIterator Maven / Gradle / Ivy

Go to download

Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.

There is a newer version: 9.0.2
Show newest version
package org.simpleflatmapper.util;

import java.util.Iterator;

public final class TransformIterator implements Iterator {
		private final Iterator it;
		private final Function transformer;

		public TransformIterator(Iterator it, Function transformer) {
			this.it = it;
			this.transformer = transformer;
		}

		@Override
		public void remove() {
			throw new UnsupportedOperationException("remove");
		}
		
		@Override
		public boolean hasNext() {
			return it.hasNext();
		}

		@Override
		public O next() {
			return transformer.apply(it.next());
		}
	}