Good morning,
Sorry if this has already been asked but i'm stuck on a java project that I'm building.
It is a program that allows the user to insert a bet (for example the predicted result of a sports match) and at a later time allows an user to insert the definitive result of said match.
This is done by 2 LinkedHashMaps. One with a key value pair of User and predicted score and one of User and definitive score.
The order of the keys in both LinkedHashMaps will be the same as they get their input for the key from another Array with the names of the users. So only the predicted and the definitive score gets set every time. (The key gets set by calling .get on the array with the names of the users).
What I want to do is compare the value in the LinkedHashMap with the predicted scores to the value in LinkedHashMap with the definitive score. This however, needs to be compared per key-value pair. So I can't just check for the equality of both LinkedHashMaps. For example, with four users only one can have predicted the right score. If I check the equality of both LinkedHashMaps to another it checks the key-value pairs as a whole. I need to get one boolean result per key-value pair.
I thought of checking the equality of the index posisition of the value but this not how LinkedHashMaps work. The LinkedHashMap Key and the LinkedHashMap value are both custom objects (the key being an instance of a class with a set string in it, the value being an enum).
How would I go about doing this?
I'm currently thinking of first calling .toArray on both LinedHashMap per " index " posisition and checking the equality of that one to a set amount.. like this; (voorspellingen is LinkedHashMap 1, uitslagen is the other LinkedHashMap)
voorspellingen.keySet().toArray()[0])
uitslagen.keySet().toArray()[0])
if (etc.)
But i'm not sure if this would be the most "effective" way of doing it...