Using ArrayList instead of LinkedList in Join to be memory-efficient