DoubleStream sorted()
returns a stream consisting of the elements of this stream in sorted order.
sorted
has the following syntax.
DoubleStream sorted()
The following example shows how to use sorted
.
import java.util.stream.DoubleStream; /*from w w w .ja va2 s.c o m*/ public class Main { public static void main(String[] args) { DoubleStream d = DoubleStream.of(1.2,4.5,1.2,2.3); DoubleStream r = d.sorted(); r.forEach(System.out::println); } }
The code above generates the following result.