DoubleStream empty() es un método en java.util.stream.DoubleStream. Este método devuelve un DoubleStream secuencial vacío.
Sintaxis:
static DoubleStream empty() Where, DoubleStream is a sequence of primitive double-valued elements and the function returns an empty sequential stream.
Ejemplo 1 :
// Java code for DoubleStream empty() import java.util.*; import java.util.stream.DoubleStream; class GFG { // Driver code public static void main(String[] args) { // creating an empty DoubleStream, a sequence of // primitive double-valued elements DoubleStream stream = DoubleStream.empty(); // Displaying an empty sequential stream System.out.println(stream.count()); } }
Producción:
0
Ejemplo 2:
// Java code for DoubleStream empty() import java.util.*; import java.util.stream.DoubleStream; class GFG { // Driver code public static void main(String[] args) { // creating an empty DoubleStream, a sequence of // primitive double-valued elements DoubleStream stream = DoubleStream.empty(); // Displaying an empty sequential stream System.out.println(Arrays.toString(stream.toArray())); } }
Producción:
[]
Publicación traducida automáticamente
Artículo escrito por Sahil_Bansall y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA