try code in take().foreach()