@Nullable
  private static <K, T> Map.Entry<K, T> findFirstInMapByKey(
      Map<K, T> map, List<Predicate<K>> keyMatches) {
    return keyMatches.stream()
        .map(keyMatch -> findFirstInMapByKey(map, keyMatch))
        .filter(Objects::nonNull)
        .findFirst()
        .orElse(null);
  }
Returns the first entry matching the given key predicates (short-circuiting in the order of
predicates).
jib-core/src/main/java/com/google/cloud/tools/jib/registry/credentials/DockerConfig.java