String (@NotNull List<? extends Pair<Long, String>> times) { String stats = times.stream() .sorted(Comparator.comparingLong((Pair<Long, String> p) -> p.first).reversed()) .filter(p -> p.first > 10) .limit(10) .map(p -> "\"" + p.second + "\"" + " took " + p.first + "ms") .collect(Collectors.joining(", ")); return stats.isEmpty() ? "insignificant" : stats; }