Join-based. minor optimizations: List<Integer> result is initialized in the constructor.