[Solved] Java String comparison wrong outcome [closed]


You should write it like that, way easier to read :

if (!Arrays.asList(ip, port, username, password).contains(newSet))
{
    saveButton.setEnabled(true);
}
else
{
    saveButton.setEnabled(false);
}

Or :

saveButton.setEnabled(!Arrays.asList(ip, port, username, password).contains(newSet));

1

solved Java String comparison wrong outcome [closed]