The transformation to Scala is pretty straightforward: immutable variables start with val
; you can drop the type specification (it's inferred), and instantiating arrays is not a special case, but is just like instantiating a List
or Map
, etc.
val budgetId = budgetService.mutate(Array(budgetOperation)).getValue(0).getBudgetId()
The IntelliJ Scala plugin has a feature that will attempt to automatically convert Java code to Scala. While it doesn't always get it right, it may be of aid in learning how to map Java constructs into Scala.
manpreet
Best Answer
2 years ago
In Google Adwords API, this is the Java code to get the budget id:
I need to convert this to Scala code as I am working with Google AdWords API in Scala.