public static ArrayList<Stock> fromJson(JSONArray jsonQuotes) throws JSONException {
  ArrayList<Stock> stocks=new ArrayList<Stock>();
  for (int i=0; i < jsonQuotes.length(); i++) {
    JSONObject jsonQuoteItem=(JSONObject)jsonQuotes.get(i);
    stocks.add(new Stock(jsonQuoteItem));
  }
  return stocks;
}

public static ArrayList < Stock > fromJson ( JSONArray jsonQuotes ) throws JSONException { ArrayList < Stock > stocks = new ArrayList < Stock > ( ) ; for ( int i = 0 ; i < jsonQuotes . length ( ) ; i ++ ) { JSONObject jsonQuoteItem = ( JSONObject ) jsonQuotes . get ( i ) ; stocks . add ( new Stock ( jsonQuoteItem ) ) ; } return stocks ; }
factory method for creating array of stock from json array .
