/// <summary> /// Replaces a number of elements in the receiver with the same number of elements of another list. /// Replaces elements in the receiver, between <code>from</code> (inclusive) and <code>to</code> (inclusive), /// with elements of <code>other</code>, starting from <code>otherFrom</code> (inclusive). /// /// <summary> /// <param name="from">the position of the first element to be replaced in the receiver</param> /// <param name="to">the position of the last element to be replaced in the receiver</param> /// <param name="other">list holding elements to be copied into the receiver.</param> /// <param name="otherFrom">position of first element within other list to be copied.</param> public virtual void ReplaceFromToWithFrom(int from, int to, AbstractLongList other, int otherFrom) { int Length = to - from + 1; if (Length > 0) { CheckRangeFromTo(from, to, Size); CheckRangeFromTo(otherFrom, otherFrom + Length - 1, other.Size); // unambiguous copy (it may hold other==this) if (from <= otherFrom) { for (; --Length >= 0;) { SetQuick(from++, other.GetQuick(otherFrom++)); } } else { int otherTo = otherFrom + Length - 1; for (; --Length >= 0;) { SetQuick(to--, other.GetQuick(otherTo--)); } } } }
/// <summary> /// Compares the specified Object with the receiverd /// Returns true if and only if the specified Object is also an ArrayList of the same type, both Lists have the /// same _size, and all corresponding pairs of elements in the two Lists are identical. /// In other words, two Lists are defined to be equal if they contain the /// same elements in the same order. /// /// <summary> /// <param name="otherObj">the Object to be compared for equality with the receiver.</param> /// <returns>true if the specified Object is equal to the receiver.</returns> public override Boolean Equals(Object otherObj) { //delta if (!(otherObj is AbstractLongList)) { return(false); } if (this == otherObj) { return(true); } if (otherObj == null) { return(false); } AbstractLongList other = (AbstractLongList)otherObj; if (Size != other.Size) { return(false); } for (int i = Size; --i >= 0;) { if (GetQuick(i) != other.GetQuick(i)) { return(false); } } return(true); }