Gravitational collapse in one dimension