public override void Add(T item) { DojoListNode current = FrontNode; if (FrontNode == null) { FrontNode = new DojoListNode() { Data = item } } ; else { while (current.Next != null) { current = current.Next; } current.Next = new DojoListNode() { Data = item }; } nodeCount++; }
public DojoListNode() { IsDummyNode = false; Data = default; Next = default; Previous = default; }
public override void Add(T item) { _ = FrontNode == null ? FrontNode = BackNode = new DojoListNode { Data = item } : BackNode.Next = BackNode = new DojoListNode { Data = item }; }
public override int Size() { int counter = 0; DojoListNode currentNode = base.FrontNode; while (currentNode != null) { counter++; currentNode = currentNode.Next; } return(counter); }
public override string ToString() { string result = "["; DojoListNode current = FrontNode; while (current != null) { string separator = current.Next == null ? "" : ", "; if (!current.IsDummyNode) { result += $"{current.Data.ToString()}{separator}"; } current = current.Next; } result += "]"; return(result); }
public override void Add(T item) { DojoListNode newNode = new DojoListNode(); newNode.Data = item; newNode.Next = null; if (base.FrontNode == null) { base.FrontNode = newNode; base.BackNode = newNode; return; } else { BackNode.Next = newNode; base.BackNode = newNode; } }
public override void Add(T item) { DojoListNode node = new DojoListNode(); node.Data = item; if (FrontNode == null) { FrontNode = node; BackNode = node; } else { BackNode.Next = node; BackNode = node; } size++; }