以A字段排序之后,在A相等的情况下再以B字段对相等的部分进行排序,最后得到一个总的排序结果
像objc里面只需要使用三行语句就可以
NSSortDescriptor * sortBuy = [NSSortDescriptor sortDescriptorWithKey:@"Price" ascending:NO];
NSSortDescriptor * sortQty = [NSSortDescriptor sortDescriptorWithKey:@"LeavesQty" ascending:NO];
[self->listBuy sortUsingDescriptors:@[sortBuy, sortQty]];
1
共 2 条评论, 1 页
评论区
写评论sort_by_key(|k|(k.a,k.b))
https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.then