@PreDestroy
 public void destroy() {
   log.info("Remove Cache Manager metrics");
   SortedSet<String> names = metricRegistry.getNames();
   names.forEach(metricRegistry::remove);
   log.info("Closing Cache Manager");
   cacheManager.shutdown();
 }
예제 #2
0
  public static void main(String[] args) {

    // Sort the names based on their length, placing null first

    SortedSet<String> names =
        new TreeSet<>(Comparator.nullsFirst(Comparator.comparing(String::length)));
    names.add("HTML");
    names.add("JAVA");
    names.add("SQL");
    names.add("CSS");
    names.add(null); // Adds a null

    names.forEach(System.out::println);
  }