title: How to store values from hashmap in an String array
body: <p>I've got a some loop which gets "key" string from model class, and i want to cast those values to array String, but I'm not sure how I can make it. Basicly, my app gets the current currency exchange from api, and I get them from it using hashmap, and I just want to store those values as an array.</p>
  
  <p>Java class</p>
  
  <pre><code>public void retrofit() {
      Call&lt;Model&gt; call = api.getRatesByGivenCurrency(BASE_URL);
      call.enqueue(new Callback&lt;Model&gt;() {
          @Override
          public void onResponse(Call&lt;Model&gt; call, Response&lt;Model&gt; response) {
              if (!response.isSuccessful()) {
                  Toast.makeText(exchange_currency.this, response.code(), Toast.LENGTH_LONG).show();
              }
              list = Collections.singletonList(response.body());
  
              for (Model model : list) {
                  Iterator&lt;Map.Entry&lt;String, Double&gt;&gt; entries = model.getRates().entrySet().iterator();
                  while (entries.hasNext()) {
                      Map.Entry entry = (Map.Entry) entries.next();
                      keyString = (String) entry.getKey();
                      valueDouble = (Double) entry.getValue();
                  }
              }
          }
          @Override
          public void onFailure(Call&lt;Model&gt; call, Throwable t) {
              Toast.makeText(exchange_currency.this, t.getMessage(), Toast.LENGTH_LONG).show();
          }
      });
   }
  }
  </code></pre>
  
  <p>Model class</p>
  
  <pre><code>public class Model {
  
  @SerializedName("base")
  private String base;
  @SerializedName("rates")
  private Map&lt;String, Double&gt; rates;
  
  public void setRates(Map&lt;String, Double&gt; rates) {
      this.rates = rates;
  }
  
  public void setBase(String base) {
      this.base = base;
  }
  
  public String getBase() {
      return base;
  }
  
  public Map&lt;String, Double&gt; getRates() {
      return rates;
  }
  
  
  class Rates {
  
      @SerializedName("BGN")
      private Double bGN;
  
      @SerializedName("NZD")
      private Double nZD;
  
      @SerializedName("ILS")
      private Double iLS;
  
      @SerializedName("RUB")
      private Double rUB;
  
      @SerializedName("CAD")
      private Double cAD;
  
      @SerializedName("USD")
      private Double uSD;
  
      @SerializedName("PHP")
      private Double pHP;
  
      @SerializedName("CHF")
      private Double cHF;
  
      @SerializedName("ZAR")
      private Double zAR;
  
      @SerializedName("AUD")
      private Double aUD;
  
      @SerializedName("JPY")
      private Double jPY;
  
      @SerializedName("TRY")
      private Double tRY;
  
      @SerializedName("HKD")
      private Double hKD;
  
      @SerializedName("MYR")
      private Double mYR;
  
      @SerializedName("THB")
      private Double tHB;
  
      @SerializedName("HRK")
      private Double hRK;
  
      @SerializedName("NOK")
      private Double nOK;
  
      @SerializedName("IDR")
      private Double iDR;
  
      @SerializedName("DKK")
      private Double dKK;
  
      @SerializedName("CZK")
      private Double cZK;
  
      @SerializedName("HUF")
      private Double hUF;
  
      @SerializedName("GBP")
      private Double gBP;
  
      @SerializedName("MXN")
      private Double mXN;
  
      @SerializedName("KRW")
      private Double kRW;
  
      @SerializedName("ISK")
      private Double iSK;
  
      @SerializedName("SGD")
      private Double sGD;
  
      @SerializedName("BRL")
      private Double bRL;
  
      @SerializedName("PLN")
      private Double pLN;
  
      @SerializedName("INR")
      private Double iNR;
  
      @SerializedName("RON")
      private Double rON;
  
      @SerializedName("CNY")
      private Double cNY;
  
      @SerializedName("SEK")
      private Double sEK;
  
      public Double getBGN() {
          return bGN;
      }
  
      public void setBGN(Double value) {
          this.bGN = value;
      }
  
      public Double getNZD() {
          return nZD;
      }
  </code></pre>
  
  <p>etc...</p>
  
  <p>Api interface</p>
  
  <pre><code>public interface Api {
  
  
  
  @GET("latest")
  Call&lt;Model&gt; getRatesByGivenCurrency(@Query("base") String base);
  </code></pre>
  
  <p>Here's the api <a href="https://exchangeratesapi.io/" rel="nofollow noreferrer">https://exchangeratesapi.io/</a></p>