We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
look the code in scala REPL:
scala> import scala.collection._ import scala.collection._ scala> val l = mutable.MutableList(1,2) l: scala.collection.mutable.MutableList[Int] = MutableList(1, 2) scala> val t = l.tail t: scala.collection.mutable.MutableList[Int] = MutableList(2) scala> l += 3 res0: l.type = MutableList(1, 2, 3) // unnormal start here..... scala> t.length res3: Int = 1 // the t.length is 1, but why REPL print MutableList(2, 3) scala> t res1: scala.collection.mutable.MutableList[Int] = MutableList(2, 3) // and t.toString print MutableList(2) scala> t.toString res5: String = MutableList(2)
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-8976?orig=1 Reporter: zavakid (zava) Affected Versions: 2.11.2
Sorry, something went wrong.
@som-snytt said: Just to answer the question, the tail iterator doesn't know how long it is.
scala> val it = t.iterator it: Iterator[Int] = non-empty iterator scala> it.next res1: Int = 2 scala> it.next res2: Int = 3 scala> it.hasNext res3: Boolean = false
zavakid (zava) said: @A. P. Marki So you means the t's iterator and length has semantic conflict ?
@som-snytt said: Psychic conflict.
scala/scala#4133
som-snytt
No branches or pull requests
look the code in scala REPL:
The text was updated successfully, but these errors were encountered: