java - Attempting to loop through an ArrayList to find duplicates, if statement never seems to return true -
I'm trying to loop through an ArrayList of the card object to find fake cards. If the statement is to compare two different items in the list and if a duplicate is found then just set a boolean on the right.
Duplicate in Public Boolean () {Boolean isDupe = false; For (int a = 0; a Public Zero Test Duplicate () {if (pc.hasDuplicate () == true} {System.out.println ("is a cheat"); } If (pc.has duplicates () == incorrect) {System.out.println ("no duplays"); }}
It always outputs "no duplex" in the form of a conditional statement, which never brings boolean to the fire.
Any help (read: pointing to my mistake mistakes) would be greatly appreciated thanks!
public boolean par (object obj) This indicates whether any other object is "equal to this" it is one
If you are comparing two different objects, then you have equlas () method is required to be implemented, you need equals () code> card class.
Comments
Post a Comment