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

com.merkle.oss.magnolia.powernode.PowerNodeIterator Maven / Gradle / Ivy

There is a newer version: 2.1.1
Show newest version
package com.merkle.oss.magnolia.powernode;

import org.apache.jackrabbit.commons.iterator.NodeIteratorAdapter;

import javax.jcr.NodeIterator;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

public class PowerNodeIterator> extends NodeIteratorAdapter {
	private final AbstractPowerNodeDecorator powerNodeDecorator;

	PowerNodeIterator(
			final AbstractPowerNodeDecorator powerNodeDecorator,
			final NodeIterator iterator
	) {
		super(iterator);
		this.powerNodeDecorator = powerNodeDecorator;
	}

	@Override
	public N nextNode() throws NoSuchElementException {
		return powerNodeDecorator.wrapNode(super.nextNode());
	}

	public Stream toStream() {
		return StreamSupport.stream(Spliterators.spliteratorUnknownSize((Iterator)this, Spliterator.ORDERED), false);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy