Here you can find the source of filter(final Set
public static Set<ZonedDateTime> filter(final Set<ZonedDateTime> list, final ZonedDateTime base, final long minute)
//package com.java2s; import java.time.Duration; import java.time.ZonedDateTime; import java.util.Set; import java.util.stream.Collectors; public class Main { public static Set<ZonedDateTime> filter(final Set<ZonedDateTime> list, final ZonedDateTime base, final long minute) { if (list == null || base == null) { throw new IllegalArgumentException("args must not be null"); }//from w w w. j ava2 s . c o m if (minute < 0) { throw new IllegalArgumentException("minute must be potitive"); } final Set<ZonedDateTime> result = list.stream().filter(p -> { final long diff = Duration.between(base, p).toMinutes(); return (diff == 60); }).collect(Collectors.toSet()); return result; } }