Java, Eclipse Collections, Open Source, Primitive Collections, Java Stream Api.
Stream<LocalDate> stream = Stream.of( now, now.plusDays(1L), now.plusDays(2L), now.plusDays(3L)); LongBag longs = stream.collect( Collectors2.collectLong( LocalDate::toEpochDay, LongBags.mutable::empty)); LongBag expected = LongBags.mutable.with(19874L, 19875L, 19876L, 19877L);