Package com.jongsoft.lang.control

The control package contains flow control interfaces. These can be used to direct the logical flow of your code easier.

Current support control mechanisms

  • Optional, for null safe access to elements
  • Try, for exception handling logic
  • Equal, for logical equality building

The Optional is a functional representation of a value, or null. In both cases the Optional itself will be non null and allow functional access to its contents. It allows for handling when a value is present as well as supporting control operations in case no value is present.

    // Sample usage of the Optional
     API.Option("one")
          .ifPresent(System.out::println)
          .orElse(() -> System.out.println("No value is present");
 
Since:
0.0.1