arraylist of custom object obtained from tostring representation

60 views Asked by At

I'm storing an Arraylist of a custom class BetDisplayer, its toString format looks like this :

[BetDisplayer{user='[email protected]', id='p3ojqbes4vletb5i0sc2drq77d', stake=70, returns=252, status='won', actualselections={9=X}, userselections={9=X}, selections='(9/X)'}, BetDisplayer{user='[email protected]', id='48207hoos47vmlq57oelbfl03q', stake=500, returns=1800, status='won', actualselections={9=X}, userselections={9=X}, selections='(9/X)'}, BetDisplayer{user='[email protected]', id='v2jbr5bj6n42eab3iqdlt1l6ie', stake=580, returns=2088, status='won', actualselections={9=X}, userselections={9=X}, selections='(9/X)'}

I'm trying to recover the arraylist from its toString representation however I am not sure how to approach it with this format.

1

There are 1 answers

4
fill͡pant͡ On

Well you need to create a custom algorythm to load them from a string that will be hard to express and also it may be faulty. To be on the safe side i would recomend either trying your luck with Yaml configuration files or Json, they both have pros and cons and there are pleny of libraries out there for them like Gson for Json and snakeyaml for Yaml.

Good luck :- )