public void printTry1(String option1String, String option2String, String option3String) { if (option1String.equals("1") || option1String.equalsIgnoreCase("Y") || option1String.equalsIgnoreCase("Yes") || option1String.equalsIgnoreCase("T") || option1String.equalsIgnoreCase("TRUE")) printHeader(); if (option2String.equals("1") || option2String.equalsIgnoreCase("Y") || option2String.equalsIgnoreCase("Yes") || option2String.equalsIgnoreCase("T") || option2String.equalsIgnoreCase("TRUE")) printDetails(); if (option3String.equals("1") || option3String.equalsIgnoreCase("Y") || option3String.equalsIgnoreCase("Yes") || option3String.equalsIgnoreCase("T") || option3String.equalsIgnoreCase("TRUE")) printFooter(); }
public void printImagined(boolean option1, boolean option2, boolean option3) { if (option1) printHeader(); if (option2) printDetails(); if (option3) printFooter(); }
public void2print(String option1String, String option2String, String option3String) { if (conformOption(option1String)) printHeader(); if (conformOption(option2String)) printDetails(); if (conformOption(option3String)) printFooter(); } private boolean1conformOption(String option) { List<String> trueStrings; trueStrings = Arrays.asList("y", "t", "yes", "true", "1"); for (String trueString: trueStrings) if (option.equalsIgnoreCase(trueString)) return true; return false; }