No video

Java8 | 61 | How to create optional objects | Tamil

Optional is a class in Java 8 that is used to represent a value that may or may not be present. This is useful for representing situations where a value may not be available, such as when a method returns a value but may return null if the value is not found.
The Optional class has a number of methods for working with optional values, such as:
❇️ isPresent(): Returns true if the optional value is present, false otherwise.
❇️ get(): Returns the present value, or throws a NoSuchElementException if the optional value is not present.
❇️ orElse(): Returns a default value if the optional value is not present.
❇️ ifPresent(): Executes a block of code if the optional value is present.
Optional can be used to make your code more robust and easier to read. By using Optional, you can avoid NullPointerExceptions and make it clear to readers of your code that a value may not always be available.

Пікірлер: 4

  • @shibushiva5755
    @shibushiva57555 ай бұрын

    Super Explanation Sir.

  • @premkumar-jz4di
    @premkumar-jz4di10 ай бұрын

    super sir well teaching

  • @user-no3vb5ob5s
    @user-no3vb5ob5s10 ай бұрын

    watched most of your java 8 videos its really very help full for me sir .🤗 You were taught very well can easily understood.👌 can you upload next videos for java

  • @LearnAutomationOnline

    @LearnAutomationOnline

    10 ай бұрын

    I’m publishing one video per day Monday through Friday. Stay tuned