Collection.stream(): This method is available in java.util.ArrayList class of Java.
Syntax:
Stream<E> java.util.Collection.stream()
This method returns a sequential Stream with this collection as its source.
Parameters: NA
Returns: a sequential Stream over the elements in this collection.
Exceptions: NA
Approach
Java
import java.util.ArrayList;public class ArrayListstream {public static void main(String[] args) {ArrayList<Integer> arr = new ArrayList<>();arr.add(1);arr.add(2);arr.add(3);System.out.println(arr.stream());}}
Output:
java.util.stream.ReferencePipeline$Head@606d8acf
No comments:
Post a Comment