I'm trying to calculate the aspect ratio of a java.awt.Rectangle
in Scala. I'm going for the "ratio of longer side to shorter side" definition of aspect ratio, not the "width to height" type of aspect ratio.
The following code works, but is there any way to avoid temporary variable and turn it into a one-liner?
val sizes = Seq(rect.getWidth, rect.getHeight)
val aspectRatio = sizes.max / sizes.min