
solid.converters.Doubles Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of solid Show documentation
Show all versions of solid Show documentation
Solid is an Android library, which provides lightweight data streams and immutable+parcelable collections.
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