mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Add firstObject: method existing since 10.6
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38595 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d95d88c102
commit
36aa478b39
3 changed files with 22 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2015-06-01 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* Headers/Foundation/NSArray.h
|
||||
* Source/NSArray.m
|
||||
Add firstObject: method existing since 10.6
|
||||
|
||||
2015-05-26 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSURLConnection.m: Fix leak of limit date
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Interface for NSArray for GNUStep
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-2015 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
Created: 1995
|
||||
|
@ -105,6 +105,9 @@ typedef NSUInteger NSBinarySearchingOptions;
|
|||
- (id) initWithObjects: (const id[])objects
|
||||
count: (NSUInteger)count;
|
||||
- (id) lastObject;
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
||||
- (id) firstObject;
|
||||
#endif
|
||||
|
||||
/** <override-subclass />
|
||||
* Returns the object at the specified index.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/** NSArray - Array object to hold other objects.
|
||||
Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-2015 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
||||
From skeleton by: Adam Fedor <fedor@boulder.colorado.edu>
|
||||
|
@ -978,6 +978,17 @@ static SEL rlSel;
|
|||
return [self objectAtIndex: count-1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first object in the receiver, or nil if the receiver is empty.
|
||||
*/
|
||||
- (id) firstObject
|
||||
{
|
||||
NSUInteger count = [self count];
|
||||
if (count == 0)
|
||||
return nil;
|
||||
return [self objectAtIndex: 0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes each object in the array perform aSelector.<br />
|
||||
* This is done sequentially from the first to the last object.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue