|
Re: Empty Iterators: msg#00423lang.scala
Iterator[+a] is covariant in a. That means that X<:Y implies Iterator[X]<:Iterator[Y]. And since Nothing <: T for any T, you have Iterator[Nothing] <: Iterator[T] for any T you can think of, even if it is a type parameter A. In short, having an empty iterator of type Iterator[Nothing] is just as good as having one of type Iterator[A]. hope this helps, Burak On 1/27/07,
Miles Sabin <miles@xxxxxxxxxxxxxx> wrote: What's the canonical way of getting an empty Iterator[A]? Iterator.empty -- Burak Emir Research Assistant / PhD Candidate Programming Methods Group EPFL, 1015 Lausanne, Switzerland http://lamp.epfl.ch/~emir |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Another nit: 00423, David Pollak |
|---|---|
| Next by Date: | Re: Another nit: 00423, Imam Tashdid ul Alam |
| Previous by Thread: | Empty Iteratorsi: 00423, Miles Sabin |
| Next by Thread: | Re: Empty Iterators: 00423, Miles Sabin |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |