private void Init(int capacity) { if (capacity < 0) { capacity = 0; } this.count = 0; this.size = 0; this.capacity = -1; this.fromIndex = 0; if (this.freePeek == null) { this.freePeek = PoolQueueCopyable <int> .Spawn(capacity); } this.freePeek.Clear(); if (this.free == null) { this.free = PoolHashSetCopyable <int> .Spawn(capacity); } this.free.Clear(); if (this.freePrepared == null) { this.freePrepared = PoolHashSetCopyable <int> .Spawn(capacity); } this.freePrepared.Clear(); this.Resize_INTERNAL(capacity); }
public void CopyFrom(RefList <T> other) { ArrayUtils.Copy(in other.arr, ref this.arr); if (this.freePrepared != null) { PoolHashSetCopyable <int> .Recycle(ref this.freePrepared); } this.freePrepared = PoolHashSetCopyable <int> .Spawn(other.freePrepared.Count); this.freePrepared.CopyFrom(other.freePrepared); if (this.freePeek != null) { PoolQueueCopyable <int> .Recycle(ref this.freePeek); } this.freePeek = PoolQueueCopyable <int> .Spawn(other.freePeek.Count); this.freePeek.CopyFrom(other.freePeek); if (this.free != null) { PoolHashSetCopyable <int> .Recycle(ref this.free); } this.free = PoolHashSetCopyable <int> .Spawn(other.free.Count); this.free.CopyFrom(other.free); this.size = other.size; this.capacity = other.capacity; this.count = other.count; this.fromIndex = other.fromIndex; this.initCapacity = other.initCapacity; }