RBFragmentedArray Class Reference

Inherits from NSObject
Declared in RBFragmentedArray.h

Overview

An array that allows non-contiguous (fragmented) indexes.

  firstIndex

The first (lowest) index of an object stored in the array.

@property (nonatomic, readonly) NSUInteger firstIndex

Declared In

RBFragmentedArray.h

  lastIndex

The last (highest) index of an object stored in the array.

@property (nonatomic, readonly) NSUInteger lastIndex

Declared In

RBFragmentedArray.h

  count

The number of objects stored in the array.

@property (nonatomic, readonly) NSUInteger count

Declared In

RBFragmentedArray.h

  firstObject

The first object (with the lowest index) stored in the array.

@property (nonatomic, readonly, nullable) id firstObject

Declared In

RBFragmentedArray.h

  lastObject

The last object (with the highest index) stored in the array.

@property (nonatomic, readonly, nullable) id lastObject

Declared In

RBFragmentedArray.h

  indexes

An array of indexes for which objects are stored in the array.

@property (nonatomic, readonly, nonnull) NSArray *indexes

Declared In

RBFragmentedArray.h

– setObject:atIndex:

Sets the object stored in the array at a given index.

- (void)setObject:(nullable id)object atIndex:(NSUInteger)index

Parameters

object

The object to store. If object is nil the object at index will be removed.

index

The index at which to store the object.

Declared In

RBFragmentedArray.h

– removeObjectAtIndex:

Removes the object stored at the given index.

- (void)removeObjectAtIndex:(NSUInteger)index

Parameters

index

The index at which the object is stored.

Declared In

RBFragmentedArray.h

– removeAllObjects

Removes all of the objects stored in the array.

- (void)removeAllObjects

Declared In

RBFragmentedArray.h

– hasIndex:

Determines whether an object is stored at the given index.

- (BOOL)hasIndex:(NSUInteger)index

Parameters

index

The index at which to check if an object is stored.

Return Value

Whether or not an object is stored at the given index.

Declared In

RBFragmentedArray.h

– objectAtIndex:

Retrieves the object stored at the given index.

- (nullable id)objectAtIndex:(NSUInteger)index

Parameters

index

The index to retrieve the object for.

Return Value

The object stored at the index, or nil if there was no object found.

Declared In

RBFragmentedArray.h

– enumerateObjectsUsingBlock:

Enumerates the objects stored in the array.

- (void)enumerateObjectsUsingBlock:(nonnull void ( ^ ) ( id __nonnull obj , NSUInteger idx , BOOL *__nonnull stop ))block

Parameters

block

The block to call on each object in the array.

Declared In

RBFragmentedArray.h

– enumerateObjectsWithOptions:usingBlock:

Enumerates the objects stored in the array.

- (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts usingBlock:(nonnull void ( ^ ) ( id __nonnull obj , NSUInteger idx , BOOL *__nonnull stop ))block

Parameters

opts

The enumeration options to use.

block

The block to call on each object in the array.

Declared In

RBFragmentedArray.h

– enumerateObjectRemovalUsingBlock:

Enumerates each object in the array for removal.

- (void)enumerateObjectRemovalUsingBlock:(nonnull BOOL ( ^ ) ( id __nonnull obj , NSUInteger idx , BOOL *__nonnull stop ))block

Parameters

block

The block to call on each object, if the block returns true the object is removed.

Declared In

RBFragmentedArray.h