祝日休日、土曜日曜を除く平日のリストあるいは Stream を求める

自分が開発した Java祝日計算、
Java祝日計算 プロジェクト日本語トップページ - OSDN
より、任意の月の祝日休日、土曜日曜を除く平日の Stream を求める。

準備として、この Java祝日計算 では、以下のように祝日休日のリストを求めるのには、以下が存在する。

int year = 2018;
int month = 2;

LocalDate[] days = Holiday.listHoliDayDates(year, month);
List<Holiday.HolidayBundle> blist = Holiday.listHolidayBundle(year, month);

ここから、月の日付と突き合わせるようにMapを作るのだが、key=LocalDate 、valueをどうするか?

int year = 2018;
int month = 2;
Map<LocalDate, LocalDate> map = Arrays.stream(Holiday.listHoliDayDates(year, month))
.collect(()->new HashMap<LocalDate, LocalDate>(), (r, t)->r.put(t, t), (r, u)->r.putAll(u));

これでも良いが、後から value として休日の名称が必要なMapを用意するならば、

int year = 2018;
int month = 2;
Map<LocalDate, String> map = Holiday.listHolidayBundle(year, month).stream()
.collect(()->new HashMap<LocalDate, String>(), (r, t)->{
   r.put(t.getDate(), t.getDescription());
   Optional.ofNullable(t.getChangeDate()).ifPresent(d->r.put(d, "振替休日"));
}, (r, u)->r.putAll(u));

月初日から Stream.iterate を使用して用意したMap とつき合わせて結果 Stream を求める。
List にしたければ、更に、collect(Collectors.toList()) で求める。

int year = 2018;
int month = 2;
Map<LocalDate, LocalDate> map = Arrays.stream(Holiday.listHoliDayDates(year, month))
.collect(()->new HashMap<LocalDate, LocalDate>(), (r, t)->r.put(t, t), (r, u)->r.putAll(u));

Stream<LocalDate> daystream = Stream.iterate(LocalDate.of(year, month, 1), t->t.plusDays(1))
.limit(LocalDate.of(year, month, 1).lengthOfMonth())
.filter(e->!e.getDayOfWeek().equals(DayOfWeek.SATURDAY) && !e.getDayOfWeek().equals(DayOfWeek.SUNDAY) && !map.containsKey(e));

List<LocalDate> list = daystream.collect(Collectors.toList());

DayOfWeek.SATURDAY と DayOfWeek.SUNDAY を !equal で判定することに抵抗があるなら、

int year = 2018;
int month = 2;
Map<LocalDate, LocalDate> map = Arrays.stream(Holiday.listHoliDayDates(year, month))
.collect(()->new HashMap<LocalDate, LocalDate>(), (r, t)->r.put(t, t), (r, u)->r.putAll(u));

Stream<LocalDate> daystream = Stream.iterate(LocalDate.of(year, month, 1), t->t.plusDays(1))
.limit(LocalDate.of(year, month, 1).lengthOfMonth())
.filter(e->1 <= e.getDayOfWeek().getValue() && e.getDayOfWeek().getValue() <= 5 && !map.containsKey(e));

List<LocalDate> list = daystream.collect(Collectors.toList());

という具合だ。