Skip to content

Use of Optionals in Java 8 #94

@CLOVIS-AI

Description

@CLOVIS-AI

Since Java 8, Optionals were added to replace null when a method can not return a result, as seen in JsonObject with the methods get, getInt ...

Although the current use of default values is convenient, I think it would be good to allow the use of Optionals, as they allow more control.

I am ready to make the changes myself and submit a pull request, but I'm not sure if it's better, regarding this project's policy, to do it:

  1. replace the current methods' return type by Optionals (can cause problems with dependancies)
  2. add new methods (like getOptional, getIntOptional), which can make the code a bit "messy" (and maybe deprecate the old ones)

Do you think it's worth doing it, and if it is, which would be the best way (I mean, the most user-friendly way) of implementing it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions