For performance reasons it's better to store these as potentially `null` values other than options. Also there is a spacing issue here:

`var prevItem: T = null`