Index: src/OFList.h
==================================================================
--- src/OFList.h
+++ src/OFList.h
@@ -123,10 +123,30 @@
* \brief Removes the object with the specified list object from the list.
*
* \param listObject The list object returned by append / prepend
*/
- (void)removeListObject: (of_list_object_t*)listObject;
+
+/**
+ * \brief Returns the first object of the list or nil.
+ *
+ * The returned object is not retained and autoreleased for performance
+ * reasons!
+ *
+ * \return The first object of the list or nil
+ */
+- (id)firstObject;
+
+/**
+ * \brief Returns the last object of the list or nil.
+ *
+ * The returned object is not retained and autoreleased for performance
+ * reasons!
+ *
+ * \return The last object of the list or nil
+ */
+- (id)lastObject;
@end
@interface OFListEnumerator: OFEnumerator
{
OFList *list;
Index: src/OFList.m
==================================================================
--- src/OFList.m
+++ src/OFList.m
@@ -172,10 +172,26 @@
[listObject->object release];
[self freeMemory: listObject];
}
+
+- (id)firstObject
+{
+ if (firstListObject != NULL)
+ return firstListObject->object;
+
+ return nil;
+}
+
+- (id)lastObject
+{
+ if (lastListObject != NULL)
+ return lastListObject->object;
+
+ return nil;
+}
- (size_t)count
{
return count;
}