@@ -133,10 +133,46 @@ */ + (instancetype) arrayWithObjects: (ObjectType const _Nonnull *_Nonnull)objects count: (size_t)count; +/*! + * The objects of the array as a C array. + * + * The result is valid until the autorelease pool is released. If you want to + * use the result outside the scope of the current autorelease pool, you have to + * copy it. + */ +@property (readonly, nonatomic) + ObjectType const __unsafe_unretained _Nonnull *_Nonnull objects; + +/*! + * The first object of the array or `nil`. + * + * @warning The returned object is *not* retained and autoreleased for + * performance reasons! + */ +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) ObjectType firstObject; + +/*! + * The last object of the array or `nil`. + * + * @warning The returned object is *not* retained and autoreleased for + * performance reasons! + */ +@property OF_NULLABLE_PROPERTY (readonly, nonatomic) ObjectType lastObject; + +/*! + * The array sorted in ascending order. + */ +@property (readonly, nonatomic) OFArray OF_GENERIC(ObjectType) *sortedArray; + +/*! + * The array with the order reversed. + */ +@property (readonly, nonatomic) OFArray OF_GENERIC(ObjectType) *reversedArray; + /*! * @brief Initializes an OFArray with the specified object. * * @param object An object * @return An initialized OFArray @@ -230,17 +266,10 @@ * @param range The range to copy */ - (void)getObjects: (ObjectType __unsafe_unretained _Nonnull *_Nonnull)buffer inRange: (of_range_t)range; -/*! - * @brief Returns the objects of the array as a C array. - * - * @return The objects of the array as a C array - */ -- (ObjectType const __unsafe_unretained _Nonnull *_Nonnull)objects; - /*! * @brief Returns the index of the first object that is equivalent to the * specified object or `OF_NOT_FOUND` if it was not found. * * @param object The object whose index is returned @@ -276,30 +305,10 @@ * @return A boolean whether the array contains an object with the specified * address */ - (bool)containsObjectIdenticalTo: (ObjectType)object; -/*! - * @brief Returns the first object of the array or `nil`. - * - * @warning The returned object is *not* retained and autoreleased for - * performance reasons! - * - * @return The first object of the array or `nil` - */ -- (nullable ObjectType)firstObject; - -/*! - * @brief Returns the last object of the array or `nil`. - * - * @warning The returned object is *not* retained and autoreleased for - * performance reasons! - * - * @return The last object of the array or `nil` - */ -- (nullable ObjectType)lastObject; - /*! * @brief Returns the objects in the specified range as a new OFArray. * * @param range The range for the subarray * @return The subarray as a new autoreleased OFArray @@ -372,17 +381,10 @@ * array */ - (void)makeObjectsPerformSelector: (SEL)selector withObject: (nullable id)object; -/*! - * @brief Returns a copy of the array sorted in ascending order. - * - * @return A sorted copy of the array - */ -- (OFArray OF_GENERIC(ObjectType) *)sortedArray; - /*! * @brief Returns a copy of the array sorted using the specified selector and * options. * * @param selector The selector to use to sort the array. It's signature @@ -413,17 +415,10 @@ - (OFArray OF_GENERIC(ObjectType) *) sortedArrayUsingComparator: (of_comparator_t)comparator options: (int)options; #endif -/*! - * @brief Returns a copy of the array with the order reversed. - * - * @return A copy of the array with the order reversed - */ -- (OFArray OF_GENERIC(ObjectType) *)reversedArray; - /*! * @brief Creates a new array with the specified object added. * * @param object The object to add * @return A new array with the specified object added @@ -445,18 +440,10 @@ * @param object The object to remove * @return A new array with the specified object removed */ - (OFArray OF_GENERIC(ObjectType) *)arrayByRemovingObject: (ObjectType)object; -/*! - * @brief Returns an OFEnumerator to enumerate through all objects of the - * array. - * - * @returns An OFEnumerator to enumerate through all objects of the array - */ -- (OFEnumerator OF_GENERIC(ObjectType) *)objectEnumerator; - #ifdef OF_HAVE_BLOCKS /*! * @brief Executes a block for each object. * * @param block The block to execute for each object