class DefaultMetaStoreEventCompactor {

  public List<MetaStoreEvent> compact(List<MetaStoreEvent> tableEvents) {
    LinkedList<MetaStoreEvent> finalEvents = new LinkedList<>();
    for (MetaStoreEvent e : tableEvents) {
      switch (e.getEventType()) {
      case DROP_TABLE:
        // Keep only previous drop events
        processDropTable(finalEvents, e);
        break;
      case DROP_PARTITION:
        mergeOrAdd(finalEvents, e, evt -> evt.isDropEvent());
        break;
      case CREATE_TABLE:
      case ADD_PARTITION:
      case ALTER_PARTITION:
      case INSERT:
        mergeOrAdd(finalEvents, e, evt -> !evt.isDropEvent());
        break;
      default:
        log.debug("Unknown event type {}: adding to list of event", e.getEventType());
        finalEvents.add(e);
        break;
      }
    }
    return finalEvents;
  }

    DefaultMetaStoreEventCompactor();
    DefaultMetaStoreEventCompactor(EventMerger eventMerger);

}