Write a Java function that determines if a given string is a palindrome. The function should return true if the input string is a palindrome and false otherwise. Palindromes are strings that read the same backward as forward, ignoring spaces, punctuation, and capitalization.
For example:
Provide a concise and efficient Java code solution along with any explanations or considerations. Feel free to include additional test cases to showcase the robustness of your solution. Thank you!
For example:
Java:
public class PalindromeChecker {
public static boolean isPalindrome(String str) {
// Your code goes here
return false;
}
public static void main(String[] args) {
// Example usage:
System.out.println(isPalindrome("A man, a plan, a canal, Panama")); // Should print true
System.out.println(isPalindrome("Java is fun")); // Should print false
}
}
Provide a concise and efficient Java code solution along with any explanations or considerations. Feel free to include additional test cases to showcase the robustness of your solution. Thank you!