CtrlK
BlogDocsLog inGet started
Tessl Logo

martinfrancois/java-streams

Help AI coding agents use Java Streams and Collectors well in new code, review, and cleanup without replacing one antipattern with another.

100

2.17x
Quality

100%

Does it follow best practices?

Impact

100%

2.17x

Average score across 4 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-1/

Implement delivery appointment checks

Create DeliveryAppointments.java. Assume Java 24.

Implement:

List<Appointment> schedulableAppointments(Planner planner)

Rules:

  • planner.appointments() returns appointments in the planner's proposed order.
  • CalendarService.canSchedule(appointment.token()) is a blocking remote call.
  • A planner can contain hundreds of appointments, and checking one appointment at a time is too slow in production.
  • The concurrency limit is per schedulableAppointments(planner) call: during one call, run at most 8 in-flight CalendarService.canSchedule(...) calls at the same time.
  • Return only appointments that can be scheduled.
  • Sort the returned appointments by Appointment::startsAt, then Appointment::token.
  • Use Java stream APIs for the operation.

Use these nested types:

record Planner(List<Appointment> appointments) {}
record Appointment(String token, long startsAt) {}
static final class CalendarService {
    static boolean canSchedule(String token) {
        throw new UnsupportedOperationException("provided by production");
    }
}

README.md

tile.json