Top 4 Collections Interview Questions
Browse 4 real-world technical and behavioral interview questions about Collections. Review scenarios, edge cases, and architectural best practices.
A customer has been barred for non-payment and it turns out they paid three weeks ago. Walk me through how that happens and what you fix.
Almost always the money arrived but was never allocated to the invoice that dunning was watching, so an unpaid document aged past a threshold while the account balance was zero. Restore service first, then fix allocation, then make dunning read a state a human can defend.
Sorting a list throws IllegalArgumentException saying the comparison method violates its general contract. What did the comparator get wrong?
The sort detected that your comparator contradicted itself partway through a merge. The usual causes are a subtraction that overflows, an ordering that is not transitive, and a sort key that changes while the sort is running. Use this collections answer to show the decision, trade-off, and evidence rather than a memorised definition. It also connects sorting to the point an interviewer is testing.
A borrower misses a payment. Take me through what your systems do from that morning through to the loan being written off.
A missed payment moves an account along three tracks at once - a collections state, an impairment stage, and a reported credit history - and they are governed by different rules. Most of the difficulty is that forbearance and cure reset some of them and deliberately not others.
How does HashMap work internally, and what happens when it resizes?
HashMap stores entries in an array of buckets indexed by a hash of the key; collisions chain into a linked list that converts to a red-black tree past a threshold, and exceeding the load factor triggers a resize that reallocates and redistributes every entry. It also connects collections to the point an interviewer is testing.