public static Map<String, List<AdEngineBidHistoryData>> batchByMatchType(
      List<AdEngineBidHistoryData> historyDataList) {
    Map<String, List<AdEngineBidHistoryData>> matchTypeMap =
        new HashMap<String, List<AdEngineBidHistoryData>>();
    for (AdEngineBidHistoryData historyData : historyDataList) {
      if (matchTypeMap.containsKey(historyData.getMatchType())) {
        matchTypeMap.get(historyData.getMatchType()).add(historyData);
      } else {
        List<AdEngineBidHistoryData> newList = new ArrayList<AdEngineBidHistoryData>();
        newList.add(historyData);
        matchTypeMap.put(historyData.getMatchType(), newList);
      }
    }

    return matchTypeMap;
  }
 public static ProtocolEnum.SemplestMatchType getListMatchType(
     List<AdEngineBidHistoryData> historyDataList) throws Exception {
   SemplestMatchType mt = null;
   if (historyDataList != null && historyDataList.size() > 0) {
     for (AdEngineBidHistoryData histDat : historyDataList) {
       if (mt != null && !mt.toString().equalsIgnoreCase(histDat.getMatchType())) {
         throw new Exception("Different Match Types in the list");
       } else {
         if (histDat.getMatchType().equalsIgnoreCase(SemplestMatchType.Exact.toString())) {
           mt = SemplestMatchType.Exact;
         } else if (histDat.getMatchType().equalsIgnoreCase(SemplestMatchType.Phrase.toString())) {
           mt = SemplestMatchType.Phrase;
         } else if (histDat.getMatchType().equalsIgnoreCase(SemplestMatchType.Broad.toString())) {
           mt = SemplestMatchType.Broad;
         }
       }
     }
   }
   return mt;
 }