FileOutputStream
FileOutputStream is modern Java (5/8 toolkit). Lambdas are short functions: (n) -> print. They implement a functional interface (one abstract method). Streams let you filter/map/collect a list without a manual loop.
For FileOutputStream: generics keep types safe: List<String>. Autoboxing turns int into Integer when needed. varargs is String... args. Optional avoids some null checks — don’t overuse it.
Keep FileOutputStream small. Don’t dump business logic inside forEach. Know one tiny example you can write from memory.
Let's take this on the board with one tiny Main class — no extra files. FileOutputStream — output: [4, 16]. 1..5 → keep evens 2,4 → square → 4 and 16. Start from main, go line by line, and stop at each print. That output is the proof for FileOutputStream.
Explain map/filter/collect as a 3-step stream story.