Algorithm;text;Specification;Label Add(T);Assertion that checks if Adds object z to the end of the List.;z != null && elements.Add(z) && elements.Contains(z);1 AddRange(IEnumerable);Adds the elements of the specified collection to the end of the List elements.;collection != null && elements.AddRange(collection) && foreach (T element in collection) { elements.Contains(element)==TRUE };1 AsReadOnly();Returns a read-only ReadOnlyCollection wrapper for the current collection called elements.;elements != null && elements.AsReadOnly();1 BinarySearch(Int32, Int32, T, IComparer);Searches a range of elements in the sorted List for an element using the specified comparer and returns the zero-based index of the element.;comparer != null && index >= 0&& index <= elements.Count&& count >= 0&& index + count <= elements.Count && elements.BinarySearch(index, count, item, comparer);1 BinarySearch(T);Searches the entire sorted List for an element z using the default comparer and returns the zero-based index of the element.;z != null&& elements.BinarySearch(z);1 BinarySearch(T, IComparer);Searches the entire sorted List for an element z using the specified comparer and returns the zero-based index of the element.;comparer != null && z != null && elements.BinarySearch(z, comparer);1 Clear();Removes all elements from the List.;elements.Clear() && elements.Count == 0,;1 Contains(T);Determines whether an element z is in the List.;z != null && elements.Contains(z) -> methodResult==TRUE;1 ConvertAll(Converter);Converts the elements in the current List to another type, and returns a list containing the converted elements.;converter != null && elements.ConvertAll(converter);1 CopyTo(Int32, T[], Int32, Int32);Copies a range of elements from the List to a compatible one-dimensional array, starting at the specified index of the target array.;"index >= 0 && index <= elements.Count && array != null && arrayIndex >= 0 && arrayIndex < array.Length && count >= 0 && index + count <= elements.Count && elements.CopyTo(index, array, arrayIndex, count);";1 CopyTo(T[]);Copies the entire List to a compatible one-dimensional array, starting at the beginning of the target array.;array != null && elements.CopyTo(array);1 CopyTo(T[], Int32);Copies the entire List to a compatible one-dimensional array, starting at the specified index of the target array.;array != null && arrayIndex >= 0 && arrayIndex < array.Length && elements.CopyTo(array, arrayIndex);1 EnsureCapacity(Int32);Ensures that the capacity of this list is at least the specified capacity. If the current capacity is less than capacity, it is increased to at least the specified capacity.;minCapacity >= 0 && elements.Capacity = Math.Max(elements.Capacity, minCapacity) -> elements.Capacity >= minCapacity ==TRUE;1 Equals(Object);Determines whether the specified object z is equal to the current object.;"z is MyCollection&& var otherCollection = (MyCollection)z -> elements.SequenceEqual(otherCollection.elements)==TRUE";1 Exists(Predicate);Determines whether the List contains elements that match the conditions defined by the specified predicate z.;z != null && elements.Exists(z)==TRUE;1 Find(Predicate);Searches for an element z that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire List.;z != null && elements.Contains(z) == TRUE -> elements.Find(z);1 FindAll(Predicate);Retrieves all the elements that match the conditions defined by the specified predicate z.;"z != null && elements.Contains(z)-> elements.FindAll(z);";1 FindIndex(Int32, Int32, Predicate);Searches for an element that matches the conditions defined by the specified predicate z, and returns the zero-based index of the first occurrence within the range of elements in the List that starts at the specified index and contains the specified number of elements.;0 <= startIndex < elements.Count && count <= elements.Count - startIndex && z != null && elements.FindIndex(startIndex, count, z) == -1 || (startIndex <= elements.FindIndex(startIndex, count, z) < startIndex + count);1 FindIndex(Int32, Predicate);Searches for an element that matches the conditions defined by the specified predicate z, and returns the zero-based index of the first occurrence within the range of elements in the List that extends from the specified index to the last element.;0 <= startIndex < elements.Count && match != null && elements.FindIndex(startIndex, z) == -1 || (startIndex <= elements.FindIndex(startIndex, z) < elements.Count);1 FindIndex(Predicate);Searches for an element that matches the conditions defined by the specified predicate z, and returns the zero-based index of the first occurrence within the entire List.;z != null && elements.FindIndex(z) == -1 or (0 <= elements.FindIndex(z) < elements.Count);1 FindLast(Predicate);Searches for an element that matches the conditions defined by the specified predicate z, and returns the last occurrence within the entire List.;z != null && elements.FindLast(z);1 FindLastIndex(Int32, Int32, Predicate);Searches for an element that matches the conditions defined by the specified predicate z, and returns the zero-based index of the last occurrence within the range of elements in the List that contains the specified number of elements and ends at the specified index.; 0 <= startIndex < elements.Count && 0 <= count <= elements.Count - startIndex && z != null && elements.FindLastIndex(startIndex, count, z) == -1 or (startIndex <= elements.FindLastIndex(startIndex, count, z) < startIndex + count);1 FindLastIndex(Int32, Predicate);Searches for an element that matches the conditions defined by the specified predicate z, and returns the zero-based index of the last occurrence within the range of elements in the List that extends from the first element to the specified index.;0 <= startIndex < elements.Count && z != null && elements.FindLastIndex(startIndex, z) == -1 or (startIndex <= elements.FindLastIndex(startIndex, z) < elements.Count;1 FindLastIndex(Predicate);Searches for an element that matches the conditions defined by the specified predicate z, and returns the zero-based index of the last occurrence within the entire List.;z != null && elements.FindLastIndex(z) == -1 or (0 <= elements.FindLastIndex(z) < elements.Count);1 GetEnumerator();Returns an enumerator that iterates through the List.;"enumerator = elements.GetEnumerator() && enumerator != null && isinstance(enumerator, IEnumerator[T]) && while enumerator.MoveNext() { element = enumerator.Current elementCount += 1 assert elementCount == len(elements) }";1 GetHashCode();Serves as the default hash function.;z = elements.GetHashCode(element);1 GetRange(Int32, Int32);Creates a shallow copy of a range of elements in the source List.;rangeList = elements.GetRange(index, count) && len(rangeList) == count && rangeList == elements[index:index+count];1 GetType();Gets the Type of the current instance.;z = elements.GetType() && z != null && z == typeof(List[T]);1 IndexOf(T);Searches for the specified object and returns the zero-based index of the first occurrence within the entire List.;index = elements.IndexOf(item) && isinstance(index, int) && index != -1 -> elements[index] == item && index == -1 || (0 <= index < len(elements));1 IndexOf(T, Int32);Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the List that extends from the specified index to the last element.;index = elements.IndexOf(item, startIndex) && index != -1 -> elements[index] == item && index == -1 || (0 <= index < len(elements));1 IndexOf(T, Int32, Int32);Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the List that starts at the specified index and contains the specified number of elements.;z = elements.IndexOf(item, startIndex, count) && z != -1 -> elements[index] == z && z == -1 || (0 <= z < len(elements));1 Capacity;Gets or sets the total number of elements the internal data structure can hold without resizing.;z = elements.Capacity && z >= len(elements);1 Count;Gets the number of elements contained in the List.;z = elements.Count && z == len(elements);1 Item[Int32];Gets the element at the specified index.;z = elements[index] && z != null ;1 x*y;Assertion that check if z is x times y, and if x is 0 then z should be 0;z = x*y && x = 0 -> z==0;1 x+y;Assertion that checks whether z is equal to x + y and, if x is 0, whether z is equal to y;z = x + y && x = 0 -> z==y;1 x-y;Assertion that checks whether z is equal to x - y and, if x is 0, whether z is equal to -y;z = x - y && x = 0 -> z==0-y;1 x/y;Assertion that checks whether y is not equal to 0 (to avoid division by zero), whether z is equal to x / y, and if x is 0, whether z is also 0. ;z = x / y && y != 0 && x = 0 -> z==0;1 x%y;Assertion that checks whether y is not equal to 0, whether z is equal to x % y, and if x is 0, whether z is also 0;z = x % y && y != 0 && x = 0 -> z==0;1 x**y;Assertion that checks whether z is equal to the result of x ** y;z = x ** y;1 x//y;Assertion that checks whether z is equal to the result of x // y;z = x // y;1 Math.Max(x,y);Assertion that checks if z is the highest value of x and y;z = Math.Max(x, y);1 Math.Min(x,y);Assertion that checks if z is the lowest value of of x and y;z = Math.Min(x, y);1 Math.Sqrt(x);Assertion that checks if z is the square root of x;z = Math.Sqrt(x) && x >= 0;1 Math.Abs(x);Assertion that checks if z is the absolute (positive) value of x;z = Math.Abs(x);1