Is it possible to create an alias for an array element in scala? The code below will not work, but something like that.
var str=new ArrayBuffer[String](10) def alias = str(1) alias="test" print(alias)
Below is the code and basically what I want to do with the code above. But I do not want to type str (ALIAS) every time I use this variable. I want a shorter name
var str=new ArrayBuffer[String](10) val ALIAS=1 str(ALIAS) = "test" print(str(ALIAS))
source share