I have a string like this:
pet:cat::car:honda::location:Japan::food:sushi
Now : indicates key-value pairs while ::
:
::
Try this code - see the comments for an explanation:
HashMap hmap = new HashMap<>(); String str="abc:1::xyz:2::jkl:3"; String straraay[]= str.split("::?"); for(int i=0;i