Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Program to convert Boxed Array to Stream in Java
A boxed array is an array which is defined in the form of an object, instead of the primitives.
Example
Following is the program to convert Boxed Array to Stream in Java −
import java.util.*;
import java.util.stream.*;
public class Demo {
public static void main(String args[]) {
String arr[] = { "Laptop", "Mobile", "Notebook", "Desktop" };
System.out.println("Array = "+ Arrays.toString(arr));
Stream<String>s = Stream.of(arr);
System.out.println("Stream (array to stream) = "+ Arrays.toString(s.toArray()));
}
}
Output
Array = [Laptop, Mobile, Notebook, Desktop] Stream (array to stream) = [Laptop, Mobile, Notebook, Desktop]
Advertisements
