diff options
Diffstat (limited to 'src/dotnet-library')
-rw-r--r-- | src/dotnet-library/scala/runtime/RichChar.scala | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/dotnet-library/scala/runtime/RichChar.scala b/src/dotnet-library/scala/runtime/RichChar.scala index c9cde3f11a..e35663a6dd 100644 --- a/src/dotnet-library/scala/runtime/RichChar.scala +++ b/src/dotnet-library/scala/runtime/RichChar.scala @@ -48,23 +48,20 @@ final class RichChar(x: Char) extends Proxy with Ordered[Char] { def asDigit: Int = System.Char.GetNumericValue(x).toInt - private class SequentialCharIterator(limit: Char) extends BufferedIterator[Char] { + /** Create an Iterator[Char] over the characters from 'x' to 'y' - 1 + */ + def until(limit: Char): Iterator[Char] = new Iterator[Char] { private var ch = x def hasNext: Boolean = ch < limit - def next(): Char = + def next: Char = if (hasNext) { val j = ch; ch = (ch + 1).toChar; j } else throw new NoSuchElementException("next on empty iterator") - def head: Char = - if (hasNext) ch - else throw new NoSuchElementException("head on empty iterator") } - /** Create an Iterator[Char] over the characters from 'x' to 'y' - 1 - */ - def until(y: Char): Iterator[Char] = new SequentialCharIterator(y) + //def until(y: Char): Iterator[Char] = to(y) /** Create an Iterator[Char] over the characters from 'x' to 'y' */ - def to(y: Char): Iterator[Char] = new SequentialCharIterator((y + 1).toChar) + def to(y: Char): Iterator[Char] = until((y + 1).toChar) } |