Lines Matching +full:copy +full:- +full:item
2 // Protocol Buffers - Google's data interchange format
5 // Use of this source code is governed by a BSD-style
7 // https://developers.google.com/open-source/licenses/bsd
47 /// bytes, both of which are immutable) and so a simple copy is
99 // Non-nullable value types can be packed or not. in AddEntriesFrom()
108 // of the repeated field and pre-initialize the underlying collection. in AddEntriesFrom()
134 // Empty packed field. Odd, but valid - just ignore. in AddEntriesFrom()
275 … $"Cannot set Capacity to a value smaller than the current item count, {count}");
302 Array.Copy(array, 0, tmp, 0, count); in SetSize()
308 /// Adds the specified item to the collection.
310 /// <param name="item">The item to add.</param>
311 public void Add(T item) in Add() argument
313 ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item)); in Add()
315 array[count++] = item; in Add()
331 /// Determines whether this collection contains the given item.
333 /// <param name="item">The item to find.</param>
334 …/// <returns><c>true</c> if this collection contains the given item; <c>false</c> otherwise.</retu…
335 public bool Contains(T item) => IndexOf(item) != -1; field in Google.Protobuf.Collections.RepeatedField
340 /// <param name="array">The array to copy to.</param>
341 /// <param name="arrayIndex">The first index of the array to copy to.</param>
344 Array.Copy(this.array, 0, array, arrayIndex, count); in CopyTo()
348 /// Removes the specified item from the collection
350 /// <param name="item">The item to remove.</param>
351 … /// <returns><c>true</c> if the item was found and removed; <c>false</c> otherwise.</returns>
352 public bool Remove(T item) in Remove() argument
354 int index = IndexOf(item); in Remove()
355 if (index == -1) in Remove()
359 Array.Copy(array, index + 1, array, index, count - index - 1); in Remove()
360 count--; in Remove()
371 /// Gets a value indicating whether the collection is read-only.
388 Array.Copy(otherRepeatedField.array, 0, array, count, otherRepeatedField.count); in AddRange()
394 // just once and ask the collection to copy itself into the array. in AddRange()
399 … // present. (This isn't a thread-safe approach, but we don't advertise this is thread-safe.) in AddRange()
404 … // TODO: Measure whether iterating once to check and then letting the collection copy in AddRange()
407 // copy may be significantly faster than doing it one at a time. in AddRange()
408 foreach (var item in collection) in AddRange()
410 if (item == null) in AddRange()
426 foreach (T item in values) in AddRange()
428 Add(item); in AddRange()
435 … /// Within non-collection-initializer code, consider using the equivalent <see cref="AddRange"/>
522 /// Returns the index of the given item within the collection, or -1 if the item is not
525 /// <param name="item">The item to find in the collection.</param>
526 /// <returns>The zero-based index of the item, or -1 if it is not found.</returns>
527 public int IndexOf(T item) in IndexOf() argument
529 ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item)); in IndexOf()
533 if (comparer.Equals(array[i], item)) in IndexOf()
538 return -1; in IndexOf()
542 /// Inserts the given item at the specified index.
544 /// <param name="index">The index at which to insert the item.</param>
545 /// <param name="item">The item to insert.</param>
546 public void Insert(int index, T item) in Insert() argument
548 ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item)); in Insert()
554 Array.Copy(array, index, array, index + 1, count - index); in Insert()
555 array[index] = item; in Insert()
560 /// Removes the item at the given index.
562 /// <param name="index">The zero-based index of the item to remove.</param>
569 Array.Copy(array, index + 1, array, index, count - index - 1); in RemoveAt()
570 count--; in RemoveAt()
586 /// Gets or sets the item at the specified index.
591 /// <param name="index">The zero-based index of the element to get or set.</param>
592 /// <returns>The item at the specified index.</returns>
617 … void ICollection.CopyTo(Array array, int index) => Array.Copy(this.array, 0, array, index, count); in ICollection.CopyTo()
632 return count - 1; in IList.Add()
637 int IList.IndexOf(object value) => (value is T t) ? IndexOf(t) : -1;