collections
5 articles
Java Collections Interview Questions, Answered by Running Them
Seven Java collections interview questions answered with program output, including the loop removal that throws nothing and silently skips an element.
JavaJava 8 Stream API Interview Questions, With the Output to Prove It
Java 8 stream interview questions answered with output from JDK 8, 21 and 25, including a sorted() that did no work and a parallel reduce wrong every time.
JavaJava Stream API Examples, and Four Ways They Surprise You
Complete stream examples with real output — grouping, flattening, collecting to a map — plus four behaviours that cause bugs not looking like stream bugs.
JavaHashSet vs HashMap: One Is Built Out of the Other
The difference is not two designs but one — javap shows a HashSet holding a HashMap. Every behaviour, and every failure mode, follows from that.
JavaArrayList vs LinkedList: The Numbers Behind the Table
Everyone knows the complexity table. Here is what each operation actually costs when you time it — including the one result that contradicts the folklore.
Java