OptionalLong of(long) method in Java with examples
The of(long) method help us to get an OptionalLong object which contains a long value which is passed as a parameter to this method.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
public static OptionalLong of(long value)
Parameters: This method accepts a long value as parameter that will be set to the returned OptionalLong object.
Return value: This method returns an OptionalLong with the value present.
Below programs illustrate of(long) method: