public static List<EntryEvent<?, ?>> getEntryEventsMatching(
      List<CacheEvent<?, ?>> cacheEvents,
      Predicate<? super EntryEvent<?, ?>> predicate) {
    if (isNull(cacheEvents)) {
      return Collections.emptyList();
    }
    return cacheEvents.stream()
        .filter(EntryEvent.class::isInstance)
        .map(cacheEvent -> (EntryEvent<?, ?>) cacheEvent)
        .filter(predicate)
        .collect(Collectors.toList());
  }
Selects the entry events that match the given predicate.

@param cacheEvents the cache events from which to select entry events
@param predicate tests whether to include each event
@return list of entry events that match the predicate
@throws ClassCastException if the predicate matches an event that is not an {@code EntryEvent}
geode-junit/src/main/java/org/apache/geode/cache/util/TxEventTestUtil.java