Aggregating values of a path-dependent type
Taking a shower can do wonders. :)

You can take tuples instead and convert those to this.OrderLines in the constructor.

final class Order private() {
  case class OrderLine(x: Int, y: Double) { }

  def this(rawOrderLines: Seq[(Int, Double)]) = {
    this()
    _orderLines = rawOrderLines.map { case (x, y) =&gt; OrderLine(x, y) }
  }

  private var _orderLines: Seq[OrderLine] = null
  def orderLines = _orderLines
}

object Main extends App {
  val order = new Order(Seq((1, 1.0), (2, 2.0)))
  println(order.orderLines)
}


It’s simpler and more concise, although the call-site may still be rather confusing (not that it wasn’t already).