---
title: copyCollection
framework: kernel
role: pseudoSymbol
path: kernel/oscollection/1808206-copycollection
---

# copyCollection

Creates a deep copy of a collection.

## Declaration

```occ
virtual OSCollection *copyCollection(
 OSDictionary *cycleDict = 0); 
```

## Parameters

- `cycleDict`: A dictionary of all of the collections that have been copied so far, to start the copy at the top level pass NULL for cycleDict.

## Return Value

Return Value The newly copied collecton, NULL on failure.

## Overview

Overview This function copies the collection and all of the contained collections recursively. Objects that are not derived from OSCollection are retained rather than copied. Subclasses of OSCollection must override this function to properly support deep copies.

## See Also

### Miscellaneous

- [ensureCapacity](kernel/oscollection/1808212-ensurecapacity.md)
- [flushCollection](kernel/oscollection/1808219-flushcollection.md)
- [getCapacity](kernel/oscollection/1808225-getcapacity.md)
- [getCapacityIncrement](kernel/oscollection/1808233-getcapacityincrement.md)
- [getCount](kernel/oscollection/1808238-getcount.md)
- [getNextObjectForIterator](kernel/oscollection/1808244-getnextobjectforiterator.md)
- [haveUpdated](kernel/oscollection/1808248-haveupdated.md)
- [init](kernel/oscollection/1808252-init.md)
- [initIterator](kernel/oscollection/1808258-inititerator.md)
- [iteratorSize](kernel/oscollection/1808262-iteratorsize.md)
- [setCapacityIncrement](kernel/oscollection/1808267-setcapacityincrement.md)
