Thursday, April 23, 2020

List vs LinkedList

This suggests: "The difference is the internal data structure used to store the objects. An ArrayList will use a system array (like Object[]) and resize it when needed. On the other hand, a LinkedList will use an object that contains the data and a pointer to the next and previous objects in the list." ...and yes, ArrayList is List. Юлия Данилова (Yulia Danilova) suggests stuff like:

LinkedList<string> linked = new LinkedList<string>(){};
linked.AddLast("baz");
linked.AddLast("qux");
linked.AddFirst("foo");
LinkedListNode<string> node = linked.Find("foo");
linked.AddAfter(node, "bar");

No comments:

Post a Comment