Lazy sorting of entities in Java 8 Stream API on a daily basis?
问题 I have a large Java 8 Stream ( Stream<MyObject> ) with objects that looks like this: class MyObject { private String string; private Date timestamp; // Getters and setter removed from brevity } I know that all timestamps for day 1 will arrive before those in day 2 but within each day the timestamps could be out of order. I'd like to sort the MyObject 's in timestamp order on a per daily basis using the Stream API. Since the Stream is large I have to do this as lazily as possible, i.e. it