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-2/

Implement invoice bounds and temperature windows

Use $java-streams to create InvoiceBoundsAndTemperatures.java. Assume Java 17.

Implement:

Bounds<Invoice, Invoice> invoiceTotalBounds(List<Invoice> invoices)
List<Reading> readingsBeforeFirstOverheat(List<Reading> readings, double maxSafeTemperature)
List<Reading> readingsAfterInitialSafeRun(List<Reading> readings, double maxSafeTemperature)

Rules:

  • invoiceTotalBounds should return the lowest-total and highest-total invoices. For an empty invoice list, both bounds values should be null.
  • readings is in chronological order.
  • readingsBeforeFirstOverheat returns the readings from the start of the list until the first reading where temperatureCelsius > maxSafeTemperature.
  • readingsAfterInitialSafeRun skips the readings from the start of the list while temperatureCelsius <= maxSafeTemperature, then returns everything after that.

Use nested records:

record Invoice(String id, BigDecimal total) {}
record Reading(long sequence, double temperatureCelsius) {}
record Bounds<L, R>(L low, R high) {}

README.md

tile.json