我有以下表现:Java的8个流 - 检查的instanceof
scheduleIntervalContainers.stream()
.filter(sic -> ((ScheduleIntervalContainer)sic).getStartTime() != ((ScheduleIntervalContainer)sic).getEndTime())
.collect(Collectors.toList());
其中scheduleIntervalContainers的类型是ScheduleContainer
final List<ScheduleContainer> scheduleIntervalContainers
的是否有posibility检查过滤器之前的类型?
或者'.filter(ScheduleIntervalContainer.class :: isInstance).map(ScheduleIntervalContainer.class :: cast)''学到了这个解决方案,无论你喜欢什么样的风格。 – Holger