I have a problem with the contains() method which returns false even though the ArrayList contains the given Object.
My code is following:
String [] transaction = dbConnection.getPendingTransaction(username);
if (!onlineConnection.getSentTransactionRequests().contains(transaction)) {
onlineConnection.getSentTransactionRequests().add(transaction);
String packet = "RTR" + "_" + transaction[0] + "_" + transaction[2] +
"_" + transaction[3] + "_" + transaction[4];
onlineConnection.send(packet);
}
I have tried Thread.sleep() between iterations, so the ArrayList wasn't load as eagerly without success.
equalsandhashcodeare apparently not your friends.