It takes time to live. Like any work of art, life needs to be thought about. Mersault thought about his life and exercised his bewildered consciousness and his longing for happiness in a train compartment which was like one of those cells where a man learns to know what he is by what is more than himself.
The train compartments often feel as though he is in cell and his guilt/"freedom searching" keeps him confined to the cell