Here you can find the source of max(Set
public static Date max(Set<Date> dateSet)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static Date max(Set<Date> dateSet) { return (Date) new ArrayList(dateSet).stream().max(new Comparator<Date>() { @Override/* w w w . j ava 2 s . co m*/ public int compare(Date o1, Date o2) { return o1.compareTo(o2); } }).get(); } }