How to use `ClassTag` and type comparison operator, `<:` at the same time?

91 Views Asked by At

I have the following class defined,

class FixedLengthQueue[T<:Hashable](maxLength: Int) {
    private val _outdated = ArrayBuffer.empty[T]
    def outdated: Array[T] = {
      val result = _outdated.toArray[T]
      _outdated.clear()
      result
    }
  }

However, at runtime, it reports error: No ClassTag available for T. What is the syntax for defining a type as a ClassTag and using <: at the same time?

0

There are 0 best solutions below