[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Quick question on NSMutableArray
From: |
Helge Hess |
Subject: |
Re: Quick question on NSMutableArray |
Date: |
Thu, 6 Oct 2005 00:38:31 +0200 |
On 6. Okt 2005, at 00:19 Uhr, percy tiglao wrote:
Quick question: Is NSMutableArray a linked list?
Depends on the cluster subclass (NSArray is a class cluster), but
usually not. An NSMutableArray is an indexed set of objects, which
algorithm is used to implement it is up to the Foundation
implementation.
And if it isn't, then what collection class is a linked list?
Foundation has no class specifically for a "linked list" (nor for any
other specific algorithm). Unfortunately.
I am trying to implement an input-restricted dequeue, so just
addObject and removeLastObject won't work (basically, need to be able
to be able to remove from both ends of the deque, but I only need 1
side for input)
And if there is a class that I overlooked that does that exact
functionality, could you guys tell me what it is?
The theory is that the NSArray class cluster will select the "proper"
implementation for you based on the "capacity". Of course this is
utter non-sense in practice. (same thing for NSDictionary).
So either NSMutableArray works for you, or it doesn't. I wouldn't go
for a specific implementation unless Shark approved that the array is
an actual issue in your application.
Greets,
Helge
--
http://docs.opengroupware.org/Members/helge/
OpenGroupware.org