Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Both do the same thing. But the difference is that the first makes it more readable. You would exactly know that you're adding weatherforecast information to a list. In the second case you just keep on adding information, using add(), this actually looks a bit clumsy than the other.
Your program is absolutely fine. Just because you asked for a more optimal code. I reduced your memory by taking few variables instead of taking arrays and storing in them. Look at your string it follows a patter. key : value :: key : value ::.... What can we do from this? get the key till it is : , once it reaches : get value until it reaches '::'.
As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.