VOOZH about

URL: https://www.geeksforgeeks.org/java/optionalint-stream-method-in-java-with-examples/

⇱ OptionalInt stream() method in Java with examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

OptionalInt stream() method in Java with examples

Last Updated : 28 May, 2019
The stream() method help us to get value contain by OptionalInt as IntStream. If a value is present, method returns a sequential IntStream containing only that value, otherwise returns an empty IntStream. Syntax:
public IntStream stream()
Parameters: This method accepts nothing. Return value: This method returns the optional value as an IntStream. Below programs illustrate stream() method: Program 1: Output: 👁 Image
Program 2:
Comment