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
Consider using a `self =>` reference in the class definition? Then you won't need to do `val h` in each of these methods.