in scrooge-core/src/main/scala/com/twitter/scrooge/internal/TProtocols.scala [132:173]
def writeListDouble(
protocol: TProtocol,
list: collection.Seq[Double]
): Unit = {
list match {
case wrappedArray: mutable.WrappedArray.ofDouble =>
val arr = wrappedArray.array
val size = arr.length
protocol.writeListBegin(new TList(typeForCollection(TType.DOUBLE), size))
var i = 0
while (i < size) {
protocol.writeDouble(arr(i))
i += 1
}
protocol.writeListEnd()
case arrayBuffer: ArrayBuffer[Double] =>
val size = arrayBuffer.length
protocol.writeListBegin(new TList(typeForCollection(TType.DOUBLE), size))
var i = 0
while (i < size) {
protocol.writeDouble(arrayBuffer(i))
i += 1
}
protocol.writeListEnd()
case _: IndexedSeq[_] =>
val size = list.length
protocol.writeListBegin(new TList(typeForCollection(TType.DOUBLE), size))
var i = 0
while (i < size) {
protocol.writeDouble(list(i))
i += 1
}
protocol.writeListEnd()
case _ =>
val size = list.length
protocol.writeListBegin(new TList(typeForCollection(TType.DOUBLE), size))
list.foreach { element =>
protocol.writeDouble(element)
}
protocol.writeListEnd()
}
}