public static void Print(this ListDoubleNode node) { StringBuilder sb = new StringBuilder(); if (node == null) { Debug.Log(node); return; } List <ListDoubleNode> visitedNodeList = new List <ListDoubleNode>(); while (node != null) { sb.Append(node.value).Append("<->"); visitedNodeList.Add(node); node = node.next; if (visitedNodeList.Contains(node)) { sb.Append(string.Format("({0})", node.value)); Debug.Log(sb); return; } } sb.Append("Null"); Debug.Log(sb); }
public ListDoubleNode(int val) { value = val; pre = null; next = null; }