If you want to do it in just one method call you are going to have to use Regular Expressions
However, if you just want to check if the string is equal to "Y" or "YES" you could use the logical or in-between method calls.
if( str.equalsIgnoreCase("y") || str.equalsIgnoreCase("yes") )
// condition is true if the string is y or yes regardless of case
When you tried the approach you gave it checked if the string diag was equal to the string "Y" || "YES" regardless of case.