title: How to convert Object array into String arrray and split individual elements from it?
body: <p>
  The following is the question prompt: 
  Create a hash with the following information in the format - </p>
  
  <p>countryname => <code>"capital:population:currency name"</code> create at least 5 records.</p>
  
  <p>Print the details of the country having the largest population
  Print the currency name of those countries where capital name starts with "L".</p>
  
  <p>For doing this, I was thinking of populating records with <code>put()</code>, converting the values of hashmap into an array, splitting the array with <code>":"</code> delimeter, and doing a loop to figure out largest value from the respective column. </p>
  
  <p>I was wondering whether that would be the best way of doing it, or there would be a better approach. If that way is ideal, I am having trouble converting the <code>Object [] countryValues</code> (in the code below) into a String array, so I can use the split function on it. </p>
  
  <p>I expect this to split the values with <code>":"</code> delimeter.</p>
  
  
  
  <pre><code>HashMap&lt;String,String&gt; countrydata = new HashMap&lt;String, String&gt;();
  
      countrydata.put("USA", "Washington DC:323,000,000:Dollar");
      countrydata.put("Thailand", "Bangkok:69,000,000:Baht");
      countrydata.put("Vietnam", "Hanoi:93,000,000:Dong");
      countrydata.put("Laos", "Lientiane:7,000,000:Dollar");
      countrydata.put("Belize", "Belmopan:370,000:Dollar");
  
       Object [] countryValues = countrydata.keySet().toArray();
  
       for (int i=0; i&lt;countryValues.length; i++){
          String [] splitted = countryValues[i].split(":");
       }
  
       for (int j=0; j&lt;splitted.length; j++){
           System.out.println(splitted[i]);
       }
  </code></pre>
  
  
  
  
  
  <p>Error:</p>
  
  <p>Method <code>split(String)</code> is undefined for type Object.</p>