SI-8680 Avoid Stream evaluation when it is cyclic

The methods `addString` and `hasDefiniteSize` were too eagerly
implemented in case the Stream references itself and therefore contains
a cycle.

One example of such a Stream is

    val s: Stream[Int] = 1 #:: 2 #:: 3 #:: s

The cycle detection is very simple. A reference to the head of the
Stream is stored and in the iteration to reach the end it is checked
if this reference occurs again. If yes further evaluation is aborted.

Review by @ichoran