Save inventory?

Hey, I would like to save player’s Inventory in a HashMap then give gim back - how can I do that please ? :3

Thanks in advance

If later api. This may help