Class Suggestion<T>

  • Type Parameters:
    T - the type of the value contained in this suggestion
    All Implemented Interfaces:
    AutoCloseable

    public final class Suggestion<T>
    extends Object
    implements AutoCloseable
    A suggested value for a bisection search. A Suggestion is AutoCloseable in order to support (if relevant) disposal of dismissed values.
    • Method Detail

      • of

        public static <T> Suggestion<T> of​(T value)
        Create a suggestion of a value. If the given value is AutoCloseable, it will, if dismissed, it will have its close method invoked.
        Returns:
        a new suggestion containing the given value
      • of

        public static <T extends AutoCloseableSuggestion<T> of​(T value)
        Create a suggestion of an AutoCloseable object, which, if dismissed, will be disposed by having its close method invoked.
        Returns:
        a new suggestion containing the given value
      • of

        public static <T> Suggestion<T> of​(T value,
                                           Suggestion.Disposer<? super T> dismissedSuggestionDisposer)
        Create a suggestion of an object, with a custom operation for disposing if the suggestion is dismissed.
        Returns:
        a new suggestion containing the given value