HashMap – getting First Key value

Below are the values contain in the HashMap

statusName {Active=33, Renewals Completed=3, Application=15}

Java code to getting the first Key (i.e Active)

Object myKey = statusName.keySet().toArray()[0];

How can we collect the first Key “Value” (i.e 33), I want to store both the “Key” and “Value” in separate variable.

11 Answers
11

Leave a Comment