Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
Public Member Functions | Related
kCollection Interface Reference
kApi/Data

## Description

Supports forward iteration over a collection of items.

See also
  kIterator

The kCollection interface supports forward iteration over a collection of elements. Typically, the classes that implement this interface provide alternative, class-specific accessor methods with better performance. However, the kCollection interface can be used to reduce the amount of container-specific code required to iterate over a variety of collections, in contexts where performance is not important.

kObject collection = arrayList;
kIterator it = kCollection_GetIterator(collection);
kType type = kCollection_ItemType(collection);
while (kCollection_HasNext(collection, it))
{
void* item = kCollection_Next(collection, &it);
//...
}
Inheritance diagram for kCollection:

## Public Member Functions
kSize | kCollection_Count (kCollection collection)
| Gets the collection element count. More...
kIterator | kCollection_GetIterator (kCollection collection)
| Returns an iterator to the first element in the collection. More...
kBool | kCollection_HasNext (kCollection collection, kIterator iterator)
| Determines whether a collection has another item. More...
kType | kCollection_ItemType (kCollection collection)
| Gets the collection element type. More...
void * | kCollection_Next (kCollection collection, kIterator *iterator)
| Gets a pointer to the next collection element and then advances the iterator. More...

## Related
#define | kCollection_NextT(kCollection_collection, kIteratorPtr_iterator, T)
| Gets a strongly-typd pointer to next collection element and then advances the iterator. More...

The documentation for this interface was generated from the following file:

- Data/kCollection.h