Introduction

Core Foundation collection objects help you store, organize, and retrieve “quantities” of data of virtually all types. This topic describes objects that let you group together other types of objects in, for example, arrays, sets, or dictionaries.

Developers using Core Foundation for their base functionality need to understand how collections work.

Organization of This Document

In addition to organizing data for quick and accurate retrieval, collection objects bring several benefits to programming:

Core Foundation defines several types of collection objects:

Collection objects, to some degree, are containers of values. (In this document, the word “value” denotes an element contained by a collection.) But there are wide differences in how collections contain and dispense their values. The organization of the concepts in this topic reflects these differences. What might be termed the “true collections”—arrays, dictionaries, sets, and bags—are described together because of their strong similarities. Then this topic goes on to describe trees, which are structurally quite different from the true collections.

The collections API allow you to do expected things with collection objects: create them, add values to them, extract values from them, and so on. Because the programming interfaces of CFArray, CFDictionary, CFSet, and CFBag are very much alike in what they do and how they do it, the following sections include all these types in their discussions. However, the programming interfaces of CFTree objects are sufficiently different that tasks related to these objects are described in Creating and Using Tree Structures.