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

  • Home
  • SEARCH
  • 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 7805409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:13:04+00:00 2026-06-02T02:13:04+00:00

I have what I think is an interesting question. I have two arrays which

  • 0

I have what I think is an interesting question. I have two arrays which I need to merge and sort. Each array is an array of dictionary objects, but the structure of each dictionary object is different. So one array contains elements that each contain a list of, say, 12 keys/values. The other array has elements that contain a list of, say 15 keys/values. Some of the keys/values might be the same, but not necessarily in the same order, and not necessarily formatted the same (e.g., the date field is formatted differently in each array).

What I need to do (eventually) is combine them, and sort on one common key – the date field.

I don’t think an array can have elements with different structures across individual elements, can it? I’ve never used a language that will do this, although I ask because I wouldn’t be surprised if objective-c could.

Anyway, I have been reading Apple’s documentation, and there are a lot of great sorting and merging algorithms already provided. But I could use some help deciding on what approach to use.

The fact is, I only need about 5 fields, so I feel like I want to create a third array of dictionaries with the structure I want, and then transfer all items into it, then sort after. But where do I start?

If anyone has any experience with this I’d appreciate some guidance.

  • 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-02T02:13:06+00:00Added an answer on June 2, 2026 at 2:13 am

    In Objective-C you can have an NSArray with any type of object in it.Structure,that consists only of NSArrays, NSSets and NSDictionaries is called Collection.

    So you can merge them into one and easily sort it by date

    So, after merge,you could sort your array like this

    NSSortDescriptor *sortByDateDescriptor = [[NSSortDescriptor alloc] initWithKey:@"date"
                                                  ascending:YES];
    NSArray *sortDescriptors = [NSArray arrayWithObject:sortByDateDescriptor];
    NSArray *sortedArray = [mergedArray sortedArrayUsingDescriptors:sortDescriptors];   
    

    To merge to NSMutableArray’s,just use [firstrray addObjectsFromArray: secondArray];

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

Sidebar

Related Questions

I came across an interesting question today where I have two methods that, at
Related but not quite what I am looking for merge-two-branches-what-direction. Situation: I have inherited
Screen is amazing, of course, but I don't want to have to think about
I think I have a basic understanding of this, but am hoping that someone
I think I have a big problem. I have a two projects solution. First
I think I have a basic understanding of REST, but something I'm stuck on
Here's an interesting question about the various quirks of the C++ language. I have
I have an interesting question about PSL assertion. Here is a VHDL monitor process.
I came across this post , which reports the following interview question: Given two
I have a pretty simple question but I am really new to php. I

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.