Is there a reason this is in Java rather than Scala?