Multi-stream: flag N events inside a rolling T-second window per key

The classic velocity rule. Sort each key's timestamps once, then slide a fixed-size window over them - if the Nth event is within T of the first, the burst happened. It is O(n) per key after the sort, not a nested scan.

Full code & output

This topic is available to signed-in members.

Sign in Create a free account
More in JAVA

Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.

Published 2026-09-20

© Java Coding Hub · About · Contact · Privacy · Terms