-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
My goal is to copy items from the first list to the second, while when I call public ArrayList(Collection<? extends E> c) constructor it doesn't copy the first's list items.
type
ArrayListT = java_util_ArrayList;
var
list: ArrayListT;
list2: ArrayListT;
function NewArrayList(): ArrayListT;
var
result: ArrayListT;
begin
New(result);
NewArrayList := result;
end;
function NewArrayList(other: ArrayListT): ArrayListT; // corresponding Java constructor: public ArrayList(Collection<? extends E> c)
var
result: ArrayListT;
begin
New(result, other);
NewArrayList := result;
end;
begin
list := NewArrayList();
list.add(1);
list2 := NewArrayList(list);
Writeln(list);
Writeln(list2); // list2 is expected to have [1] elements instead of none
end.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels