Class Prompt


  • public final class Prompt
    extends Object
    • Method Detail

      • yesOrNo

        public static boolean yesOrNo​(boolean defaultValue,
                                      String prompt,
                                      String... args)
        Utility to prompt users for a yes/no answer. The utility will prompt user in a loop until it gets a yes/no or blank response.
        Parameters:
        defaultValue - The value to return if user provides a blank response.
        prompt - The text to display
        args - Formatting args for the prompt
        Returns:
        true if user replied with `y` or `yes`, false if user provided `n` or `no`, defaultValue if user provided empty response.