
solid.converters.Doubles Maven / Gradle / Ivy
package solid.converters;
import java.util.Iterator;
import solid.stream.ReadOnlyIterator;
import solid.stream.Stream;
public class Doubles extends Stream {
private double[] doubles;
/**
* Creates a new stream of {@link Double} type that contains all items of a given array.
*
* @param doubles an array to get items from.
* @return a new stream of {@link Double} type that contains all items of a given array.
*/
public static Stream doubles(double[] doubles) {
return new Doubles(doubles);
}
public Doubles(double[] doubles) {
this.doubles = doubles;
}
@Override
public Iterator iterator() {
return new ReadOnlyIterator() {
int i;
@Override
public boolean hasNext() {
return i < doubles.length;
}
@Override
public Double next() {
return doubles[i++];
}
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy