Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7856135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:36:16+00:00 2026-06-02T20:36:16+00:00

Say I have a collection of node instances. An integer property call zIndex will

  • 0

Say I have a collection of “node” instances. An integer property call zIndex will be used to group them.

What are the pros/cons for storing them in :
1) An array of arrays
2) A dictionary of arrays

In pseudo code, I would describe the expected result like this:

zBuffer[100] = [node1, node 2];
zBuffer[105] = [playerNode, collectable1];
zBuffer[110] = [foreground1, foreground2];

And I’m wondering about what zBuffers should be; Must NSArrays only be used for sequential read/write? Like not using non-continuous indexes?

I tried with an NSMutableArray:

[zBuffer objectAtIndex:zOrder]

But it fails if the array contains no data for that index (like out-of-bound exception).

Thanks for your advices!
J

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T20:36:18+00:00Added an answer on June 2, 2026 at 8:36 pm

    As far as I can see, one of your requirements is that the indexes you use to access zBuffer be not contiguous (100, 105, 100). In this case, I would not use an array for that, since the indexes you can use with an array must be less than the count of elements of the array (if you have 3 elements, then indexes range from 0 to 2).

    Instead I would use NSMutableDictionary, where you can use the zIndex key as a “name” for groups of objects you are looking for.

    This suggestion does not take into account any other requirements that you might have, especially concerning complexity and the kind of operations you are going to carry through on your collection of nodes (beyond accessing them through zIndex).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my case: I have a MongoDB collection in Node.Js. Let's say three
Say I have a collection of IList<Products> products And I want to group by
Say I have a collection of bytes var bytes = new byte[] {0, 1,
So say I have a collection of Bloops Class Bloop Public FirstName Public LastName
Let's say we have a collection of Person objects class Person { public string
Let's say I have a collection of objects which can be sorted using a
Let's say I have a collection like: $products = Mage::getModel('catalog/product') ->getCollection() ... ->load(); How
This is a long shot, I know... Let's say I have a collection List<MyClass>
Lets say we have the following models: (simplified) class Collection(models.Model): slug = models.SlugField() class
Say I have a collection of strings: constitution abracadabra refrigerator stackoverflow And I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.