Suppose I have a file like this:
Account1 +200
Account2 Holder:John
Account3 -200
Account2 -100
and so on.
I want to be able to query for example "Account1" for money. The Account names can be arbitrary in the text file. How should I go about doing this in Java? I know this sounds suspiciously derpish but for the life of me I can't figure out a way that seems right.
The obvious idea would be to make an ArrayList with objects of type "Account". However then every time you wanted to check an account, you'd have to go through every single item of the ArrayList and carry out getName() to check if it's equal to it, which seems very labour intensive for simply bringing up an object. Is there any way you could somehow convert between string/data and object handles since Java is an interpretive language?