In this post, we will see “How to check if the String or Number is Palindrome or not with the help of Java 8 Streams API?”

Java 8 Streams power to test Palindrome... Check it out...!!! Share on X

Here, we are going to cover below points:

  1. What is Palindrome?
  2. How to check a Palindrome using Java 8?
  3. How to check a Palindrome through other ways?

Check out: How to Pass Lambda as a Parameter in Java 8

Let’s begin,

1. What is Palindrome?

Palindrome is a word, phrase, or sequence that reads the same backward as forward, e.g., madam or level or radar etc.

Also, palindrome numbers are those numbers which represent same number if all digits are reversed. e.g., 10001

2. How to check Palindrome using Java 8?

Let’s say: In this particular example, we are checking if ‘radar’ & ‘apple’ are palindromes or not.



3. How to check Palindrome through other ways?

Using For-Loop:

Using StringBuilder:

Using Apache StringUtils:

All the above ways of verifying the Palindrome will generate the same output. 

That’s it, Java 8 Streams API is so powerful and notice how easily it simplified the way of checking the Palindrome.

Java 8 Streams power to test Palindrome... Check it out...!!! Share on X

Do you like this Post? – then check my other helpful posts:

Other Useful References:


  • Deepak Verma

    Deepak Verma is a Test Automation Consultant and Software development Engineer for more than 10 years. His mission is to help you become an In-demand full stack automation tester. He is also the founder of Techndeck, a blog and online coaching platform dedicated to helping you succeed with all the automation basics to advanced testing automation tricks. Verma Deepak