Почему он не заходит в иф ?
package com.javarush.task.task22.task2207;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
/*
Обращенные слова
*/
public class Solution {
public static List<Pair> result = new LinkedList<>();
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String fileName = reader.readLine();
String[] words = fileName.split(" ");
System.out.println(Arrays.toString(words));
StringBuilder sB;
for(int i = 0; i < words.length; i++){
for(int j = 0; j < words.length; j++){
sB = new StringBuilder(words[j]);
sB.reverse();
System.out.println(words[i] + ":" + sB);
if(words[i].equals(sB)){
result.add(new Pair(words[i], sB.toString() + "\n"));
}
}
}
System.out.println(result);
}
public static class Pair {
String first;
String second;
public Pair(){
}
public Pair(String first, String second) {
this.first = first;
this.second = second;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Pair pair = (Pair) o;
if (first != null ? !first.equals(pair.first) : pair.first != null) return false;
return second != null ? second.equals(pair.second) : pair.second == null;
}
@Override
public int hashCode() {
int result = first != null ? first.hashCode() : 0;
result = 31 * result + (second != null ? second.hashCode() : 0);
return result;
}
@Override
public String toString() {
return first == null && second == null ? "" :
first == null ? second :
second == null ? first :
first.compareTo(second) < 0 ? first + " " + second : second + " " + first;
}
}
}