Skip to content

Instantly share code, notes, and snippets.

// 1. refactor the code so it's at the same level of abstraction (SLAP).
int from = 8000;
int to = 9000;
IntStream
.rangeClosed(from, to)
.mapToObj(Port::new)
.filter(Port::isFree)
.findFirst();
class Port {