示例#1
0
文件: FList.cs 项目: whztt07/MoCross
 //============================================================
 // <T>是否和指定链表内容相等。</T>
 //
 // @param list 链表
 // @return 是否相等
 //============================================================
 public bool Equals(FList <T> list)
 {
     // 检查参数
     if (null == list)
     {
         return(false);
     }
     // 检查总数
     if (_count != list._count)
     {
         return(false);
     }
     // 检查内容
     if (_count > 0)
     {
         int            index = 0;
         FListEntry <T> entry = _first;
         while (null != entry)
         {
             T value = list.Get(index);
             if (!value.Equals(entry.value))
             {
                 return(false);
             }
             entry = entry.next;
             index++;
         }
     }
     return(true);
 }
示例#2
0
 //============================================================
 // <T>追加一个链表。</T>
 //
 // @params list 链表
 //============================================================
 public void Append(FList <T> list)
 {
     if ((null != list) && !list.IsEmpty)
     {
         FListEntry <T> entry = list._first;
         while (null != entry)
         {
             Push(entry.value);
             entry = entry.next;
         }
     }
 }