Collections: Difference between revisions

m (→‎P6opaque object (immutable in structure): Make complete, runnable example)
Line 808:
</lang>
=={{header|Elena}}==
ELENA 3.4:
 
===Arrays===
<lang elena>
// Constant array
var intArray := (1, 2, 3, 4, 5).
 
// Generic array
var stringArr := Array new:5.
stringArr[0] := "string".
 
// Typified array
arrayArray<literal> arr := literalV<literal>(5).
arr[0] := "a".
arr[1] := "b".
</lang>
 
Line 827:
<lang elena>
//Create and initialize ArrayList
var myAl := system'collections'ArrayList new; append:"Hello"; append:"World"; append:"!".
 
//Create and initialize List
var myList := system'collections'List new; append:"Hello"; append:"World"; append:"!".
</lang>
 
Line 836:
<lang elena>
//Create a dictionary
var dict := system'collections'Dictionary new.
dict["Hello"] := "World".
dict["Key"] := "Value".
</lang>
 
Anonymous user