示例#1
0
 /**
  * Print out the state of a symbolToQuotesMap.
  *
  * <p>We do not make any assumptions about the quotes list - could be unsorted, and may have
  * repetitions.
  *
  * @param symbolToQuotesMap - maps Strings to List<QuoteRecord>s
  */
 static void CheckSymbolToQuotesMap(Map<String, List<QuoteRecord>> symbolToQuotesMap) {
   for (Map.Entry<String, List<QuoteRecord>> entry : symbolToQuotesMap.entrySet()) {
     List<QuoteRecord> quotes = entry.getValue();
     for (QuoteRecord aQuote : quotes) {
       System.out.println(entry.getKey() + ":" + aQuote.toString());
     }
   }
 }
示例#2
0
 /** Return a mock of the map, useful for debugging. */
 public static Map<String, List<QuoteRecord>> GetMockDatabaseAsMap() {
   Map<String, List<QuoteRecord>> result = new TreeMap<String, List<QuoteRecord>>();
   String s1 = "AAPL";
   String s2 = "XOM";
   List<QuoteRecord> s1Quotes = new ArrayList<QuoteRecord>();
   result.put(s1, s1Quotes);
   s1Quotes.add(
       QuoteRecord.QuoteRecordFromString("'2010-04-01','1.0','2.0','0.5','1.1','123','1.5324'"));
   s1Quotes.add(
       QuoteRecord.QuoteRecordFromString("'2010-04-02','1.2','2.2','0.5','1.5','123','1.523'"));
   s1Quotes.add(
       QuoteRecord.QuoteRecordFromString("'2010-04-03','1.1','2.1','2.5','1.0','123','1.51'"));
   List<QuoteRecord> s2Quotes = new ArrayList<QuoteRecord>();
   result.put(s2, s2Quotes);
   s2Quotes.add(
       QuoteRecord.QuoteRecordFromString("'2008-05-01','4.0','2.0','0.5','4.1','123','4.5324'"));
   s2Quotes.add(
       QuoteRecord.QuoteRecordFromString("'2008-05-02','4.2','2.2','0.5','4.5','423','4.523'"));
   s2Quotes.add(
       QuoteRecord.QuoteRecordFromString("'2008-05-06','4.1','2.1','2.5','4.0','123','4.51'"));
   return result;
 }