When the for loop iterates through the 'parts' array, it just goes straight to the last 'else' statement whether it's an empty index, a period, two periods, or a character. My goal with this for loop is to simply skip over an indice if it contains nothing, a period, or two periods. Why doesn't the very first if statement run?
String[] parts = ["", "a",".","b","..","c",""]
Deque<String> a = new LinkedList<>();
for(int i=0; i<parts.length; i++) {
if (parts[i] == "" || parts[i] == "." || (parts[i] == ".." && a.size() == 0))
{
i++;
}
else if (parts[i] == ".." && a.size() >= 1) {
a.removeFirst();
}
else {
a.addFirst(parts[i]);
}
}