---
title: copyCollection
framework: kernel
role: pseudoSymbol
path: kernel/osdictionary/1808081-copycollection
---

# copyCollection

Creates a deep copy of the dictionary and its child collections.

## Declaration

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

## Parameters

- `cycleDict`: A dictionary of all of the collections that have been copied so far, which is used to track circular references. To start the copy at the top level, pass NULL.

## Return Value

Return Value The newly copied dictionary, with a retain count of 1, or NULL if there is insufficient memory to do the copy.

## Overview

Overview The receiving dictionary, and any collections it contains, recursively, are copied. Objects that are not derived from OSCollection are retained rather than copied.

## See Also

### Miscellaneous

- [ensureCapacity](kernel/osdictionary/1808087-ensurecapacity.md)
- [flushCollection](kernel/osdictionary/1808092-flushcollection.md)
- [free](kernel/osdictionary/1808101-free.md)
- [getCapacity](kernel/osdictionary/1808107-getcapacity.md)
- [getCapacityIncrement](kernel/osdictionary/1808116-getcapacityincrement.md)
- [getCount](kernel/osdictionary/1808124-getcount.md)
- [getObject](kernel/osdictionary/1808133-getobject.md)
- [getObject(const OSString *)](kernel/osdictionary/1808139-getobject.md)
- [getObject(const OSSymbol *)](kernel/osdictionary/1808148-getobject.md)
- [initWithCapacity](kernel/osdictionary/1808159-initwithcapacity.md)
- [initWithDictionary](kernel/osdictionary/1808166-initwithdictionary.md)
- [initWithObjects(const OSObject *, const OSString *, unsigned int, unsigned int)](kernel/osdictionary/1808177-initwithobjects.md)
- [initWithObjects(const OSObject *, const OSSymbol *, unsigned int, unsigned int)](kernel/osdictionary/1808181-initwithobjects.md)
- [isEqualTo](kernel/osdictionary/1808187-isequalto.md)
- [isEqualTo(const OSDictionary *)](kernel/osdictionary/1808191-isequalto.md)
- [isEqualTo(const OSDictionary *, const OSCollection *)](kernel/osdictionary/1808194-isequalto.md)
- [merge](kernel/osdictionary/1808198-merge.md)
- [removeObject](kernel/osdictionary/1808205-removeobject.md)
- [removeObject(const OSString *)](kernel/osdictionary/1808207-removeobject.md)
- [removeObject(const OSSymbol *)](kernel/osdictionary/1808209-removeobject.md)
- [serialize](kernel/osdictionary/1808214-serialize.md)
- [setCapacityIncrement](kernel/osdictionary/1808218-setcapacityincrement.md)
- [setObject](kernel/osdictionary/1808220-setobject.md)
- [setObject(const OSString *, const OSMetaClassBase *)](kernel/osdictionary/1808224-setobject.md)
- [setObject(const OSSymbol *, const OSMetaClassBase *)](kernel/osdictionary/1808227-setobject.md)
- [withCapacity](kernel/osdictionary/1808230-withcapacity.md)
- [withDictionary](kernel/osdictionary/1808234-withdictionary.md)
- [withObjects(const OSObject *, const OSString *, unsigned int, unsigned int)](kernel/osdictionary/1808237-withobjects.md)
- [withObjects(const OSObject *, const OSSymbol *, unsigned int, unsigned int)](kernel/osdictionary/1808240-withobjects.md)
