[Solved] How to check in Java whether the input Sentence is of palindrome(not exactly, but like that) in nature or not?

First take the words of str in an array. Then check whether the words in the forward order and the reverse order are same. String[] words = str.split(” “); //splits at spaces boolean flag = true; int i, last = words.length – 1; for(i = 0; i <= last/2; i++){ if(!words[i].equalsIgnoreCase(words[last – i])){ flag = … Read more

[Solved] Why iterators are not a solution for CuncurentModificationException?

From https://docs.oracle.com/javase/7/docs/api/java/util/ConcurrentModificationException.html For example, it is not generally permissible for one thread to modify a Collection while another thread is iterating over it. In general, the results of the iteration are undefined under these circumstances. Some Iterator implementations (including those of all the general purpose collection implementations provided by the JRE) may choose to throw … Read more