Sort an array of dictionary ( or array of custom model object ) keeping all optional values object at the end...











up vote
0
down vote

favorite












Facing an issue to sort an array of custom objects, requirement is :




  1. Array containing model object

  2. need to sort array but all objects ( keeping all optinals values object at the end of an array)

  3. objects containing information should come first.


I tried this way:



let mSortedFlights = gatesFlightCardArray.sorted(by: { ($0.departureFlight?.flight_number != nil || $0.arrivalFlight?.flight_number != nil) && $0.departureFlight?.time!.localizedStandardCompare(($1.departureFlight?.time!)!) == .orderedAscending  })
if mSortedFlights.count > 0 {
gatesFlightCardArray = mSortedFlights
}


but it sorting data.
Provide your inputs.










share|improve this question






















  • What exactly do you want to sort by? Flight number or time or both? If both, which is the primary sorting criteria? How should departure and arrival flight be considered?
    – gebirgsbärbel
    Nov 12 at 10:37










  • Also, if you give the code for the classes you want to sort, this would be helpful.
    – gebirgsbärbel
    Nov 12 at 10:43















up vote
0
down vote

favorite












Facing an issue to sort an array of custom objects, requirement is :




  1. Array containing model object

  2. need to sort array but all objects ( keeping all optinals values object at the end of an array)

  3. objects containing information should come first.


I tried this way:



let mSortedFlights = gatesFlightCardArray.sorted(by: { ($0.departureFlight?.flight_number != nil || $0.arrivalFlight?.flight_number != nil) && $0.departureFlight?.time!.localizedStandardCompare(($1.departureFlight?.time!)!) == .orderedAscending  })
if mSortedFlights.count > 0 {
gatesFlightCardArray = mSortedFlights
}


but it sorting data.
Provide your inputs.










share|improve this question






















  • What exactly do you want to sort by? Flight number or time or both? If both, which is the primary sorting criteria? How should departure and arrival flight be considered?
    – gebirgsbärbel
    Nov 12 at 10:37










  • Also, if you give the code for the classes you want to sort, this would be helpful.
    – gebirgsbärbel
    Nov 12 at 10:43













up vote
0
down vote

favorite









up vote
0
down vote

favorite











Facing an issue to sort an array of custom objects, requirement is :




  1. Array containing model object

  2. need to sort array but all objects ( keeping all optinals values object at the end of an array)

  3. objects containing information should come first.


I tried this way:



let mSortedFlights = gatesFlightCardArray.sorted(by: { ($0.departureFlight?.flight_number != nil || $0.arrivalFlight?.flight_number != nil) && $0.departureFlight?.time!.localizedStandardCompare(($1.departureFlight?.time!)!) == .orderedAscending  })
if mSortedFlights.count > 0 {
gatesFlightCardArray = mSortedFlights
}


but it sorting data.
Provide your inputs.










share|improve this question













Facing an issue to sort an array of custom objects, requirement is :




  1. Array containing model object

  2. need to sort array but all objects ( keeping all optinals values object at the end of an array)

  3. objects containing information should come first.


I tried this way:



let mSortedFlights = gatesFlightCardArray.sorted(by: { ($0.departureFlight?.flight_number != nil || $0.arrivalFlight?.flight_number != nil) && $0.departureFlight?.time!.localizedStandardCompare(($1.departureFlight?.time!)!) == .orderedAscending  })
if mSortedFlights.count > 0 {
gatesFlightCardArray = mSortedFlights
}


but it sorting data.
Provide your inputs.







ios closures swift4






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 12 at 7:45









Shobhakar Tiwari

4,7852154




4,7852154












  • What exactly do you want to sort by? Flight number or time or both? If both, which is the primary sorting criteria? How should departure and arrival flight be considered?
    – gebirgsbärbel
    Nov 12 at 10:37










  • Also, if you give the code for the classes you want to sort, this would be helpful.
    – gebirgsbärbel
    Nov 12 at 10:43


















  • What exactly do you want to sort by? Flight number or time or both? If both, which is the primary sorting criteria? How should departure and arrival flight be considered?
    – gebirgsbärbel
    Nov 12 at 10:37










  • Also, if you give the code for the classes you want to sort, this would be helpful.
    – gebirgsbärbel
    Nov 12 at 10:43
















What exactly do you want to sort by? Flight number or time or both? If both, which is the primary sorting criteria? How should departure and arrival flight be considered?
– gebirgsbärbel
Nov 12 at 10:37




What exactly do you want to sort by? Flight number or time or both? If both, which is the primary sorting criteria? How should departure and arrival flight be considered?
– gebirgsbärbel
Nov 12 at 10:37












Also, if you give the code for the classes you want to sort, this would be helpful.
– gebirgsbärbel
Nov 12 at 10:43




Also, if you give the code for the classes you want to sort, this would be helpful.
– gebirgsbärbel
Nov 12 at 10:43












1 Answer
1






active

oldest

votes

















up vote
0
down vote













The sort method should not sort out nil values. For example sorting this array of Int? keeps the nil values and sorts them to the end:



var a = [0, 10, 3, nil, 5, 7, 2, nil, 4]
a.sort { v0, v1 -> Bool in
guard let v0 = v0 else {
return false
}
guard let v1 = v1 else {
return true
}
return v0 < v1
}
print(a)


The result looks as follows:



[0, 2, 3, 4, 5, 7, 10, nil, nil]


For your example, I was not sure, what criteria you want to sort by. So I built an example, you can work with. I sort the array first by flight number of the departureFlight, then by flight number of arrival flight.



let sortedTrips = trips.sorted { trip0, trip1 -> Bool in
// Sort all trips where either arrival or departure flight are nil to the end
guard let departureFlight0 = trip0.departureFlight, let arrivalFlight0 = trip0.arrivalFlight else {
return false
}
guard let departureFlight1 = trip1.departureFlight, let arrivalFlight1 = trip1.arrivalFlight else {
return true
}
// Sort by primary criterion of departure flight number
if departureFlight0.flightNumber < departureFlight1.flightNumber {
return true
} else if departureFlight0.flightNumber == departureFlight1.flightNumber {
// If the departureFlightNumbers of both trips are equal, sort by arrival flight number
return arrivalFlight0.flightNumber < arrivalFlight1.flightNumber
} else {
return false
}
}
print(sortedTrips, separator: "n")


To try this out for yourselves, in addition to the sorting code also copy my classes and example data into a playground:



class Flight: CustomStringConvertible {
private(set) var flightNumber: Int
private(set) var time: String

init(flightNumber: Int, time: String) {
self.flightNumber = flightNumber
self.time = time
}

var description: String {
return "(flightNumber) at (time)"
}
}

class Trip: CustomStringConvertible {
private(set) var departureFlight: Flight?
private(set) var arrivalFlight: Flight?

init(departureFlight: Flight?, arrivalFlight: Flight?) {
self.departureFlight = departureFlight
self.arrivalFlight = arrivalFlight
}

var description: String {
return "(departureFlight?.description ?? "na") - (arrivalFlight?.description ?? "na")"
}
}

var trips = [Trip(departureFlight: Flight(flightNumber: 3, time: "10:45"), arrivalFlight: Flight(flightNumber: 9, time: "12:45")),
Trip(departureFlight: nil, arrivalFlight: Flight(flightNumber: 9, time: "12:45")),
Trip(departureFlight: Flight(flightNumber: 3, time: "12:45"), arrivalFlight: Flight(flightNumber: 5, time: "12:45")),
Trip(departureFlight: Flight(flightNumber: 8, time: "13:48"), arrivalFlight: nil),
Trip(departureFlight: nil, arrivalFlight: nil),
Trip(departureFlight: Flight(flightNumber: 4, time: "11:31"), arrivalFlight: Flight(flightNumber: 9, time: "12:45")),
Trip(departureFlight: nil, arrivalFlight: nil)]





share|improve this answer





















  • well i have an array of objects containnig arrival and departure flight , i want to sort objects using some criteria but if both arrival and departure object is optional then it should come at the end .
    – Shobhakar Tiwari
    Nov 12 at 10:58










  • @ShobhakarTiwari In the code I posted for you, all objects where arrival or departure flight are nil are sorted at the end. The trick is to first check, if they are nil and only after that sort for other criteria.
    – gebirgsbärbel
    Nov 12 at 11:11











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53257764%2fsort-an-array-of-dictionary-or-array-of-custom-model-object-keeping-all-opti%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













The sort method should not sort out nil values. For example sorting this array of Int? keeps the nil values and sorts them to the end:



var a = [0, 10, 3, nil, 5, 7, 2, nil, 4]
a.sort { v0, v1 -> Bool in
guard let v0 = v0 else {
return false
}
guard let v1 = v1 else {
return true
}
return v0 < v1
}
print(a)


The result looks as follows:



[0, 2, 3, 4, 5, 7, 10, nil, nil]


For your example, I was not sure, what criteria you want to sort by. So I built an example, you can work with. I sort the array first by flight number of the departureFlight, then by flight number of arrival flight.



let sortedTrips = trips.sorted { trip0, trip1 -> Bool in
// Sort all trips where either arrival or departure flight are nil to the end
guard let departureFlight0 = trip0.departureFlight, let arrivalFlight0 = trip0.arrivalFlight else {
return false
}
guard let departureFlight1 = trip1.departureFlight, let arrivalFlight1 = trip1.arrivalFlight else {
return true
}
// Sort by primary criterion of departure flight number
if departureFlight0.flightNumber < departureFlight1.flightNumber {
return true
} else if departureFlight0.flightNumber == departureFlight1.flightNumber {
// If the departureFlightNumbers of both trips are equal, sort by arrival flight number
return arrivalFlight0.flightNumber < arrivalFlight1.flightNumber
} else {
return false
}
}
print(sortedTrips, separator: "n")


To try this out for yourselves, in addition to the sorting code also copy my classes and example data into a playground:



class Flight: CustomStringConvertible {
private(set) var flightNumber: Int
private(set) var time: String

init(flightNumber: Int, time: String) {
self.flightNumber = flightNumber
self.time = time
}

var description: String {
return "(flightNumber) at (time)"
}
}

class Trip: CustomStringConvertible {
private(set) var departureFlight: Flight?
private(set) var arrivalFlight: Flight?

init(departureFlight: Flight?, arrivalFlight: Flight?) {
self.departureFlight = departureFlight
self.arrivalFlight = arrivalFlight
}

var description: String {
return "(departureFlight?.description ?? "na") - (arrivalFlight?.description ?? "na")"
}
}

var trips = [Trip(departureFlight: Flight(flightNumber: 3, time: "10:45"), arrivalFlight: Flight(flightNumber: 9, time: "12:45")),
Trip(departureFlight: nil, arrivalFlight: Flight(flightNumber: 9, time: "12:45")),
Trip(departureFlight: Flight(flightNumber: 3, time: "12:45"), arrivalFlight: Flight(flightNumber: 5, time: "12:45")),
Trip(departureFlight: Flight(flightNumber: 8, time: "13:48"), arrivalFlight: nil),
Trip(departureFlight: nil, arrivalFlight: nil),
Trip(departureFlight: Flight(flightNumber: 4, time: "11:31"), arrivalFlight: Flight(flightNumber: 9, time: "12:45")),
Trip(departureFlight: nil, arrivalFlight: nil)]





share|improve this answer





















  • well i have an array of objects containnig arrival and departure flight , i want to sort objects using some criteria but if both arrival and departure object is optional then it should come at the end .
    – Shobhakar Tiwari
    Nov 12 at 10:58










  • @ShobhakarTiwari In the code I posted for you, all objects where arrival or departure flight are nil are sorted at the end. The trick is to first check, if they are nil and only after that sort for other criteria.
    – gebirgsbärbel
    Nov 12 at 11:11















up vote
0
down vote













The sort method should not sort out nil values. For example sorting this array of Int? keeps the nil values and sorts them to the end:



var a = [0, 10, 3, nil, 5, 7, 2, nil, 4]
a.sort { v0, v1 -> Bool in
guard let v0 = v0 else {
return false
}
guard let v1 = v1 else {
return true
}
return v0 < v1
}
print(a)


The result looks as follows:



[0, 2, 3, 4, 5, 7, 10, nil, nil]


For your example, I was not sure, what criteria you want to sort by. So I built an example, you can work with. I sort the array first by flight number of the departureFlight, then by flight number of arrival flight.



let sortedTrips = trips.sorted { trip0, trip1 -> Bool in
// Sort all trips where either arrival or departure flight are nil to the end
guard let departureFlight0 = trip0.departureFlight, let arrivalFlight0 = trip0.arrivalFlight else {
return false
}
guard let departureFlight1 = trip1.departureFlight, let arrivalFlight1 = trip1.arrivalFlight else {
return true
}
// Sort by primary criterion of departure flight number
if departureFlight0.flightNumber < departureFlight1.flightNumber {
return true
} else if departureFlight0.flightNumber == departureFlight1.flightNumber {
// If the departureFlightNumbers of both trips are equal, sort by arrival flight number
return arrivalFlight0.flightNumber < arrivalFlight1.flightNumber
} else {
return false
}
}
print(sortedTrips, separator: "n")


To try this out for yourselves, in addition to the sorting code also copy my classes and example data into a playground:



class Flight: CustomStringConvertible {
private(set) var flightNumber: Int
private(set) var time: String

init(flightNumber: Int, time: String) {
self.flightNumber = flightNumber
self.time = time
}

var description: String {
return "(flightNumber) at (time)"
}
}

class Trip: CustomStringConvertible {
private(set) var departureFlight: Flight?
private(set) var arrivalFlight: Flight?

init(departureFlight: Flight?, arrivalFlight: Flight?) {
self.departureFlight = departureFlight
self.arrivalFlight = arrivalFlight
}

var description: String {
return "(departureFlight?.description ?? "na") - (arrivalFlight?.description ?? "na")"
}
}

var trips = [Trip(departureFlight: Flight(flightNumber: 3, time: "10:45"), arrivalFlight: Flight(flightNumber: 9, time: "12:45")),
Trip(departureFlight: nil, arrivalFlight: Flight(flightNumber: 9, time: "12:45")),
Trip(departureFlight: Flight(flightNumber: 3, time: "12:45"), arrivalFlight: Flight(flightNumber: 5, time: "12:45")),
Trip(departureFlight: Flight(flightNumber: 8, time: "13:48"), arrivalFlight: nil),
Trip(departureFlight: nil, arrivalFlight: nil),
Trip(departureFlight: Flight(flightNumber: 4, time: "11:31"), arrivalFlight: Flight(flightNumber: 9, time: "12:45")),
Trip(departureFlight: nil, arrivalFlight: nil)]





share|improve this answer





















  • well i have an array of objects containnig arrival and departure flight , i want to sort objects using some criteria but if both arrival and departure object is optional then it should come at the end .
    – Shobhakar Tiwari
    Nov 12 at 10:58










  • @ShobhakarTiwari In the code I posted for you, all objects where arrival or departure flight are nil are sorted at the end. The trick is to first check, if they are nil and only after that sort for other criteria.
    – gebirgsbärbel
    Nov 12 at 11:11













up vote
0
down vote










up vote
0
down vote









The sort method should not sort out nil values. For example sorting this array of Int? keeps the nil values and sorts them to the end:



var a = [0, 10, 3, nil, 5, 7, 2, nil, 4]
a.sort { v0, v1 -> Bool in
guard let v0 = v0 else {
return false
}
guard let v1 = v1 else {
return true
}
return v0 < v1
}
print(a)


The result looks as follows:



[0, 2, 3, 4, 5, 7, 10, nil, nil]


For your example, I was not sure, what criteria you want to sort by. So I built an example, you can work with. I sort the array first by flight number of the departureFlight, then by flight number of arrival flight.



let sortedTrips = trips.sorted { trip0, trip1 -> Bool in
// Sort all trips where either arrival or departure flight are nil to the end
guard let departureFlight0 = trip0.departureFlight, let arrivalFlight0 = trip0.arrivalFlight else {
return false
}
guard let departureFlight1 = trip1.departureFlight, let arrivalFlight1 = trip1.arrivalFlight else {
return true
}
// Sort by primary criterion of departure flight number
if departureFlight0.flightNumber < departureFlight1.flightNumber {
return true
} else if departureFlight0.flightNumber == departureFlight1.flightNumber {
// If the departureFlightNumbers of both trips are equal, sort by arrival flight number
return arrivalFlight0.flightNumber < arrivalFlight1.flightNumber
} else {
return false
}
}
print(sortedTrips, separator: "n")


To try this out for yourselves, in addition to the sorting code also copy my classes and example data into a playground:



class Flight: CustomStringConvertible {
private(set) var flightNumber: Int
private(set) var time: String

init(flightNumber: Int, time: String) {
self.flightNumber = flightNumber
self.time = time
}

var description: String {
return "(flightNumber) at (time)"
}
}

class Trip: CustomStringConvertible {
private(set) var departureFlight: Flight?
private(set) var arrivalFlight: Flight?

init(departureFlight: Flight?, arrivalFlight: Flight?) {
self.departureFlight = departureFlight
self.arrivalFlight = arrivalFlight
}

var description: String {
return "(departureFlight?.description ?? "na") - (arrivalFlight?.description ?? "na")"
}
}

var trips = [Trip(departureFlight: Flight(flightNumber: 3, time: "10:45"), arrivalFlight: Flight(flightNumber: 9, time: "12:45")),
Trip(departureFlight: nil, arrivalFlight: Flight(flightNumber: 9, time: "12:45")),
Trip(departureFlight: Flight(flightNumber: 3, time: "12:45"), arrivalFlight: Flight(flightNumber: 5, time: "12:45")),
Trip(departureFlight: Flight(flightNumber: 8, time: "13:48"), arrivalFlight: nil),
Trip(departureFlight: nil, arrivalFlight: nil),
Trip(departureFlight: Flight(flightNumber: 4, time: "11:31"), arrivalFlight: Flight(flightNumber: 9, time: "12:45")),
Trip(departureFlight: nil, arrivalFlight: nil)]





share|improve this answer












The sort method should not sort out nil values. For example sorting this array of Int? keeps the nil values and sorts them to the end:



var a = [0, 10, 3, nil, 5, 7, 2, nil, 4]
a.sort { v0, v1 -> Bool in
guard let v0 = v0 else {
return false
}
guard let v1 = v1 else {
return true
}
return v0 < v1
}
print(a)


The result looks as follows:



[0, 2, 3, 4, 5, 7, 10, nil, nil]


For your example, I was not sure, what criteria you want to sort by. So I built an example, you can work with. I sort the array first by flight number of the departureFlight, then by flight number of arrival flight.



let sortedTrips = trips.sorted { trip0, trip1 -> Bool in
// Sort all trips where either arrival or departure flight are nil to the end
guard let departureFlight0 = trip0.departureFlight, let arrivalFlight0 = trip0.arrivalFlight else {
return false
}
guard let departureFlight1 = trip1.departureFlight, let arrivalFlight1 = trip1.arrivalFlight else {
return true
}
// Sort by primary criterion of departure flight number
if departureFlight0.flightNumber < departureFlight1.flightNumber {
return true
} else if departureFlight0.flightNumber == departureFlight1.flightNumber {
// If the departureFlightNumbers of both trips are equal, sort by arrival flight number
return arrivalFlight0.flightNumber < arrivalFlight1.flightNumber
} else {
return false
}
}
print(sortedTrips, separator: "n")


To try this out for yourselves, in addition to the sorting code also copy my classes and example data into a playground:



class Flight: CustomStringConvertible {
private(set) var flightNumber: Int
private(set) var time: String

init(flightNumber: Int, time: String) {
self.flightNumber = flightNumber
self.time = time
}

var description: String {
return "(flightNumber) at (time)"
}
}

class Trip: CustomStringConvertible {
private(set) var departureFlight: Flight?
private(set) var arrivalFlight: Flight?

init(departureFlight: Flight?, arrivalFlight: Flight?) {
self.departureFlight = departureFlight
self.arrivalFlight = arrivalFlight
}

var description: String {
return "(departureFlight?.description ?? "na") - (arrivalFlight?.description ?? "na")"
}
}

var trips = [Trip(departureFlight: Flight(flightNumber: 3, time: "10:45"), arrivalFlight: Flight(flightNumber: 9, time: "12:45")),
Trip(departureFlight: nil, arrivalFlight: Flight(flightNumber: 9, time: "12:45")),
Trip(departureFlight: Flight(flightNumber: 3, time: "12:45"), arrivalFlight: Flight(flightNumber: 5, time: "12:45")),
Trip(departureFlight: Flight(flightNumber: 8, time: "13:48"), arrivalFlight: nil),
Trip(departureFlight: nil, arrivalFlight: nil),
Trip(departureFlight: Flight(flightNumber: 4, time: "11:31"), arrivalFlight: Flight(flightNumber: 9, time: "12:45")),
Trip(departureFlight: nil, arrivalFlight: nil)]






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 12 at 10:42









gebirgsbärbel

1,33211631




1,33211631












  • well i have an array of objects containnig arrival and departure flight , i want to sort objects using some criteria but if both arrival and departure object is optional then it should come at the end .
    – Shobhakar Tiwari
    Nov 12 at 10:58










  • @ShobhakarTiwari In the code I posted for you, all objects where arrival or departure flight are nil are sorted at the end. The trick is to first check, if they are nil and only after that sort for other criteria.
    – gebirgsbärbel
    Nov 12 at 11:11


















  • well i have an array of objects containnig arrival and departure flight , i want to sort objects using some criteria but if both arrival and departure object is optional then it should come at the end .
    – Shobhakar Tiwari
    Nov 12 at 10:58










  • @ShobhakarTiwari In the code I posted for you, all objects where arrival or departure flight are nil are sorted at the end. The trick is to first check, if they are nil and only after that sort for other criteria.
    – gebirgsbärbel
    Nov 12 at 11:11
















well i have an array of objects containnig arrival and departure flight , i want to sort objects using some criteria but if both arrival and departure object is optional then it should come at the end .
– Shobhakar Tiwari
Nov 12 at 10:58




well i have an array of objects containnig arrival and departure flight , i want to sort objects using some criteria but if both arrival and departure object is optional then it should come at the end .
– Shobhakar Tiwari
Nov 12 at 10:58












@ShobhakarTiwari In the code I posted for you, all objects where arrival or departure flight are nil are sorted at the end. The trick is to first check, if they are nil and only after that sort for other criteria.
– gebirgsbärbel
Nov 12 at 11:11




@ShobhakarTiwari In the code I posted for you, all objects where arrival or departure flight are nil are sorted at the end. The trick is to first check, if they are nil and only after that sort for other criteria.
– gebirgsbärbel
Nov 12 at 11:11


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53257764%2fsort-an-array-of-dictionary-or-array-of-custom-model-object-keeping-all-opti%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

List item for chat from Array inside array React Native

Thiostrepton

Caerphilly