Java Comparator.comparing not comparing?In Java how do you sort one list based on another?Order list by a related-list in JavaIs Java “pass-by-reference” or “pass-by-value”?How do I efficiently iterate over each entry in a Java Map?What is the difference between public, protected, package-private and private in Java?How do I read / convert an InputStream into a String in Java?When to use LinkedList over ArrayList in Java?How do I generate random integers within a specific range in Java?Comparing Java enum members: == or equals()?How do I convert a String to an int in Java?Creating a memory leak with JavaSwift Beta performance: sorting arrays
Removing the last element of a list
Can a ring of spell storing and access to Find spells produce an endless menagerie?
Why isn't 'chemically-strengthened glass' made with potassium carbonate? To begin with?
Why did other houses not demand this?
Why does the Starter Set wizard have six spells in their spellbook?
Is it legal to have an abortion in another state or abroad?
Heat lost in ideal capacitor charging
How to melt snow without fire or using body heat?
Freedom of Speech and Assembly in China
Gravitational Force Between Numbers
Should I split timestamp parts into separate columns?
A burglar's sunglasses, a lady's odyssey
Can a UK national work as a paid shop assistant in the USA?
Why did Jon Snow do this immoral act if he is so honorable?
Is this homebrew "Cactus Grenade" cantrip balanced?
3 prong range outlet
How did NASA Langley end up with the first 737?
Navigating a quick return to previous employer
If I arrive in the UK, and then head to mainland Europe, does my Schengen visa 90 day limit start when I arrived in the UK, or mainland Europe?
What were the Ethiopians doing in Xerxes' army?
Why do the i8080 I/O instructions take a byte-sized operand to determine the port?
What is the recommended procedure to land a taildragger in a crosswind?
What are these clip-like things?
Testing using real data of the customer
Java Comparator.comparing not comparing?
In Java how do you sort one list based on another?Order list by a related-list in JavaIs Java “pass-by-reference” or “pass-by-value”?How do I efficiently iterate over each entry in a Java Map?What is the difference between public, protected, package-private and private in Java?How do I read / convert an InputStream into a String in Java?When to use LinkedList over ArrayList in Java?How do I generate random integers within a specific range in Java?Comparing Java enum members: == or equals()?How do I convert a String to an int in Java?Creating a memory leak with JavaSwift Beta performance: sorting arrays
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Following this question about sorting a list by another list, I tried to do the same thing - but from some reason it doesn't work for me. What am I missing?
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> order = Arrays.asList(3.0, 1.0, 2.0);
nums.sort(Comparator.comparing(order::indexOf));
System.out.println(nums);
OUTPUT: [5.0, 0.9, 10.4]
It should be [0.9, 10.4, 5.0] (according to order). What am I not doing right?
EDIT: As most of you noticed, I got answer to the question I linked to all wrong. Here's what I actually want to do.
java sorting
add a comment |
Following this question about sorting a list by another list, I tried to do the same thing - but from some reason it doesn't work for me. What am I missing?
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> order = Arrays.asList(3.0, 1.0, 2.0);
nums.sort(Comparator.comparing(order::indexOf));
System.out.println(nums);
OUTPUT: [5.0, 0.9, 10.4]
It should be [0.9, 10.4, 5.0] (according to order). What am I not doing right?
EDIT: As most of you noticed, I got answer to the question I linked to all wrong. Here's what I actually want to do.
java sorting
I'm not understanding why are you trying to sortnumswithorders: looks like you simply wanna sortnums, why are you using order ?
– Leviand
May 16 at 9:52
Just noticed I wrote it wrong, edited it.
– shakedzy
May 16 at 9:53
ok now make sense :)
– Leviand
May 16 at 9:55
For this to work, eachnumselement must exist inorder
– Logan Wlv
May 16 at 9:59
add a comment |
Following this question about sorting a list by another list, I tried to do the same thing - but from some reason it doesn't work for me. What am I missing?
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> order = Arrays.asList(3.0, 1.0, 2.0);
nums.sort(Comparator.comparing(order::indexOf));
System.out.println(nums);
OUTPUT: [5.0, 0.9, 10.4]
It should be [0.9, 10.4, 5.0] (according to order). What am I not doing right?
EDIT: As most of you noticed, I got answer to the question I linked to all wrong. Here's what I actually want to do.
java sorting
Following this question about sorting a list by another list, I tried to do the same thing - but from some reason it doesn't work for me. What am I missing?
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> order = Arrays.asList(3.0, 1.0, 2.0);
nums.sort(Comparator.comparing(order::indexOf));
System.out.println(nums);
OUTPUT: [5.0, 0.9, 10.4]
It should be [0.9, 10.4, 5.0] (according to order). What am I not doing right?
EDIT: As most of you noticed, I got answer to the question I linked to all wrong. Here's what I actually want to do.
java sorting
java sorting
edited May 16 at 10:09
shakedzy
asked May 16 at 9:48
shakedzyshakedzy
1,31211639
1,31211639
I'm not understanding why are you trying to sortnumswithorders: looks like you simply wanna sortnums, why are you using order ?
– Leviand
May 16 at 9:52
Just noticed I wrote it wrong, edited it.
– shakedzy
May 16 at 9:53
ok now make sense :)
– Leviand
May 16 at 9:55
For this to work, eachnumselement must exist inorder
– Logan Wlv
May 16 at 9:59
add a comment |
I'm not understanding why are you trying to sortnumswithorders: looks like you simply wanna sortnums, why are you using order ?
– Leviand
May 16 at 9:52
Just noticed I wrote it wrong, edited it.
– shakedzy
May 16 at 9:53
ok now make sense :)
– Leviand
May 16 at 9:55
For this to work, eachnumselement must exist inorder
– Logan Wlv
May 16 at 9:59
I'm not understanding why are you trying to sort
nums with orders : looks like you simply wanna sort nums, why are you using order ?– Leviand
May 16 at 9:52
I'm not understanding why are you trying to sort
nums with orders : looks like you simply wanna sort nums, why are you using order ?– Leviand
May 16 at 9:52
Just noticed I wrote it wrong, edited it.
– shakedzy
May 16 at 9:53
Just noticed I wrote it wrong, edited it.
– shakedzy
May 16 at 9:53
ok now make sense :)
– Leviand
May 16 at 9:55
ok now make sense :)
– Leviand
May 16 at 9:55
For this to work, each
nums element must exist in order– Logan Wlv
May 16 at 9:59
For this to work, each
nums element must exist in order– Logan Wlv
May 16 at 9:59
add a comment |
4 Answers
4
active
oldest
votes
You are sorting the numbers by their position in the order list, but none of the numbers occur in the order list. In this case, indexOf will return -1 for everything, meaning everything is equal to everything else. In such a case, the resulting sort order is unspecified - though you may realistically assume that it would not change.
Oh, so I got it all wrong.. how then do I sortnumsbyorder?
– shakedzy
May 16 at 9:56
@shakedzy I don't know what you mean by "sort nums by order"
– Michael
May 16 at 9:56
@Michael I believe usingorderas the keys for sorting.
– justhalf
May 16 at 14:55
1
Since OP is usingComparator.comparing(...)the actual comparator will always compare-1to-1, meaning all elements are equal. So the contract is not violated.
– SamYonnou
May 16 at 16:41
@SamYonnou Good catch. Updated my answer
– Michael
May 16 at 16:46
add a comment |
You can make a list of pairs :
[3.0, 5.0]
[1.0, 0.9]
[2.0, 10.4]
Then sort this list of pairs by the first value of each array :
[1.0, 0.9]
[2.0, 10.4]
[3.0, 5.0]
Here is the code :
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> order = Arrays.asList(3.0, 1.0, 2.0);
List<Double[]> pairs = new ArrayList<>();
for (int i = 0; i < nums.size(); i++)
pairs.add(new Double[] order.get(i), nums.get(i));
pairs.sort(Comparator.comparing(pair -> pair[0]));
for (Double[] pair : pairs)
System.out.print(pair[1] + " ");
Output :
0.9 10.4 5.0
add a comment |
Update
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> order = Arrays.asList(3.0, 1.0, 2.0);
Map<Double,Double> numToOrder = new HashMap<>();
for (int i = 0; i < nums.size(); ++i)
numToOrder.put(nums.get(i), order.get(i));
nums.sort(Comparator.comparing(num -> numToOrder.get(num)));
System.out.println(nums);
Original (wrong) answer
(nums is modified in place, and the lambda returning key returns wrong results)
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> order = Arrays.asList(3.0, 1.0, 2.0);
nums.sort(Comparator.comparing(num -> order.get(nums.indexOf(num))));
System.out.println(nums);
2
Results in[0.9, 5.0, 10.4], which is wrong
– Michael
May 16 at 10:07
add a comment |
The Comparator you are supplying calls indexOf for every num passed.
The returned values are -1 on all calls, so the order is preserverd as-is.
You need to sort natural.
Sorting by another list of Double should be possible, but unnecessarily complicated, it would be simpler to provide a custom Object which sorts as desired.
add a comment |
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',
autoActivateHeartbeat: false,
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f56165647%2fjava-comparator-comparing-not-comparing%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
You are sorting the numbers by their position in the order list, but none of the numbers occur in the order list. In this case, indexOf will return -1 for everything, meaning everything is equal to everything else. In such a case, the resulting sort order is unspecified - though you may realistically assume that it would not change.
Oh, so I got it all wrong.. how then do I sortnumsbyorder?
– shakedzy
May 16 at 9:56
@shakedzy I don't know what you mean by "sort nums by order"
– Michael
May 16 at 9:56
@Michael I believe usingorderas the keys for sorting.
– justhalf
May 16 at 14:55
1
Since OP is usingComparator.comparing(...)the actual comparator will always compare-1to-1, meaning all elements are equal. So the contract is not violated.
– SamYonnou
May 16 at 16:41
@SamYonnou Good catch. Updated my answer
– Michael
May 16 at 16:46
add a comment |
You are sorting the numbers by their position in the order list, but none of the numbers occur in the order list. In this case, indexOf will return -1 for everything, meaning everything is equal to everything else. In such a case, the resulting sort order is unspecified - though you may realistically assume that it would not change.
Oh, so I got it all wrong.. how then do I sortnumsbyorder?
– shakedzy
May 16 at 9:56
@shakedzy I don't know what you mean by "sort nums by order"
– Michael
May 16 at 9:56
@Michael I believe usingorderas the keys for sorting.
– justhalf
May 16 at 14:55
1
Since OP is usingComparator.comparing(...)the actual comparator will always compare-1to-1, meaning all elements are equal. So the contract is not violated.
– SamYonnou
May 16 at 16:41
@SamYonnou Good catch. Updated my answer
– Michael
May 16 at 16:46
add a comment |
You are sorting the numbers by their position in the order list, but none of the numbers occur in the order list. In this case, indexOf will return -1 for everything, meaning everything is equal to everything else. In such a case, the resulting sort order is unspecified - though you may realistically assume that it would not change.
You are sorting the numbers by their position in the order list, but none of the numbers occur in the order list. In this case, indexOf will return -1 for everything, meaning everything is equal to everything else. In such a case, the resulting sort order is unspecified - though you may realistically assume that it would not change.
edited May 16 at 16:46
answered May 16 at 9:53
MichaelMichael
22.9k83976
22.9k83976
Oh, so I got it all wrong.. how then do I sortnumsbyorder?
– shakedzy
May 16 at 9:56
@shakedzy I don't know what you mean by "sort nums by order"
– Michael
May 16 at 9:56
@Michael I believe usingorderas the keys for sorting.
– justhalf
May 16 at 14:55
1
Since OP is usingComparator.comparing(...)the actual comparator will always compare-1to-1, meaning all elements are equal. So the contract is not violated.
– SamYonnou
May 16 at 16:41
@SamYonnou Good catch. Updated my answer
– Michael
May 16 at 16:46
add a comment |
Oh, so I got it all wrong.. how then do I sortnumsbyorder?
– shakedzy
May 16 at 9:56
@shakedzy I don't know what you mean by "sort nums by order"
– Michael
May 16 at 9:56
@Michael I believe usingorderas the keys for sorting.
– justhalf
May 16 at 14:55
1
Since OP is usingComparator.comparing(...)the actual comparator will always compare-1to-1, meaning all elements are equal. So the contract is not violated.
– SamYonnou
May 16 at 16:41
@SamYonnou Good catch. Updated my answer
– Michael
May 16 at 16:46
Oh, so I got it all wrong.. how then do I sort
nums by order?– shakedzy
May 16 at 9:56
Oh, so I got it all wrong.. how then do I sort
nums by order?– shakedzy
May 16 at 9:56
@shakedzy I don't know what you mean by "sort nums by order"
– Michael
May 16 at 9:56
@shakedzy I don't know what you mean by "sort nums by order"
– Michael
May 16 at 9:56
@Michael I believe using
order as the keys for sorting.– justhalf
May 16 at 14:55
@Michael I believe using
order as the keys for sorting.– justhalf
May 16 at 14:55
1
1
Since OP is using
Comparator.comparing(...) the actual comparator will always compare -1 to -1, meaning all elements are equal. So the contract is not violated.– SamYonnou
May 16 at 16:41
Since OP is using
Comparator.comparing(...) the actual comparator will always compare -1 to -1, meaning all elements are equal. So the contract is not violated.– SamYonnou
May 16 at 16:41
@SamYonnou Good catch. Updated my answer
– Michael
May 16 at 16:46
@SamYonnou Good catch. Updated my answer
– Michael
May 16 at 16:46
add a comment |
You can make a list of pairs :
[3.0, 5.0]
[1.0, 0.9]
[2.0, 10.4]
Then sort this list of pairs by the first value of each array :
[1.0, 0.9]
[2.0, 10.4]
[3.0, 5.0]
Here is the code :
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> order = Arrays.asList(3.0, 1.0, 2.0);
List<Double[]> pairs = new ArrayList<>();
for (int i = 0; i < nums.size(); i++)
pairs.add(new Double[] order.get(i), nums.get(i));
pairs.sort(Comparator.comparing(pair -> pair[0]));
for (Double[] pair : pairs)
System.out.print(pair[1] + " ");
Output :
0.9 10.4 5.0
add a comment |
You can make a list of pairs :
[3.0, 5.0]
[1.0, 0.9]
[2.0, 10.4]
Then sort this list of pairs by the first value of each array :
[1.0, 0.9]
[2.0, 10.4]
[3.0, 5.0]
Here is the code :
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> order = Arrays.asList(3.0, 1.0, 2.0);
List<Double[]> pairs = new ArrayList<>();
for (int i = 0; i < nums.size(); i++)
pairs.add(new Double[] order.get(i), nums.get(i));
pairs.sort(Comparator.comparing(pair -> pair[0]));
for (Double[] pair : pairs)
System.out.print(pair[1] + " ");
Output :
0.9 10.4 5.0
add a comment |
You can make a list of pairs :
[3.0, 5.0]
[1.0, 0.9]
[2.0, 10.4]
Then sort this list of pairs by the first value of each array :
[1.0, 0.9]
[2.0, 10.4]
[3.0, 5.0]
Here is the code :
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> order = Arrays.asList(3.0, 1.0, 2.0);
List<Double[]> pairs = new ArrayList<>();
for (int i = 0; i < nums.size(); i++)
pairs.add(new Double[] order.get(i), nums.get(i));
pairs.sort(Comparator.comparing(pair -> pair[0]));
for (Double[] pair : pairs)
System.out.print(pair[1] + " ");
Output :
0.9 10.4 5.0
You can make a list of pairs :
[3.0, 5.0]
[1.0, 0.9]
[2.0, 10.4]
Then sort this list of pairs by the first value of each array :
[1.0, 0.9]
[2.0, 10.4]
[3.0, 5.0]
Here is the code :
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> order = Arrays.asList(3.0, 1.0, 2.0);
List<Double[]> pairs = new ArrayList<>();
for (int i = 0; i < nums.size(); i++)
pairs.add(new Double[] order.get(i), nums.get(i));
pairs.sort(Comparator.comparing(pair -> pair[0]));
for (Double[] pair : pairs)
System.out.print(pair[1] + " ");
Output :
0.9 10.4 5.0
answered May 16 at 10:05
Arnaud DenoyelleArnaud Denoyelle
19.7k756105
19.7k756105
add a comment |
add a comment |
Update
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> order = Arrays.asList(3.0, 1.0, 2.0);
Map<Double,Double> numToOrder = new HashMap<>();
for (int i = 0; i < nums.size(); ++i)
numToOrder.put(nums.get(i), order.get(i));
nums.sort(Comparator.comparing(num -> numToOrder.get(num)));
System.out.println(nums);
Original (wrong) answer
(nums is modified in place, and the lambda returning key returns wrong results)
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> order = Arrays.asList(3.0, 1.0, 2.0);
nums.sort(Comparator.comparing(num -> order.get(nums.indexOf(num))));
System.out.println(nums);
2
Results in[0.9, 5.0, 10.4], which is wrong
– Michael
May 16 at 10:07
add a comment |
Update
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> order = Arrays.asList(3.0, 1.0, 2.0);
Map<Double,Double> numToOrder = new HashMap<>();
for (int i = 0; i < nums.size(); ++i)
numToOrder.put(nums.get(i), order.get(i));
nums.sort(Comparator.comparing(num -> numToOrder.get(num)));
System.out.println(nums);
Original (wrong) answer
(nums is modified in place, and the lambda returning key returns wrong results)
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> order = Arrays.asList(3.0, 1.0, 2.0);
nums.sort(Comparator.comparing(num -> order.get(nums.indexOf(num))));
System.out.println(nums);
2
Results in[0.9, 5.0, 10.4], which is wrong
– Michael
May 16 at 10:07
add a comment |
Update
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> order = Arrays.asList(3.0, 1.0, 2.0);
Map<Double,Double> numToOrder = new HashMap<>();
for (int i = 0; i < nums.size(); ++i)
numToOrder.put(nums.get(i), order.get(i));
nums.sort(Comparator.comparing(num -> numToOrder.get(num)));
System.out.println(nums);
Original (wrong) answer
(nums is modified in place, and the lambda returning key returns wrong results)
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> order = Arrays.asList(3.0, 1.0, 2.0);
nums.sort(Comparator.comparing(num -> order.get(nums.indexOf(num))));
System.out.println(nums);
Update
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> order = Arrays.asList(3.0, 1.0, 2.0);
Map<Double,Double> numToOrder = new HashMap<>();
for (int i = 0; i < nums.size(); ++i)
numToOrder.put(nums.get(i), order.get(i));
nums.sort(Comparator.comparing(num -> numToOrder.get(num)));
System.out.println(nums);
Original (wrong) answer
(nums is modified in place, and the lambda returning key returns wrong results)
List<Double> nums = Arrays.asList(5.0, 0.9, 10.4);
List<Double> order = Arrays.asList(3.0, 1.0, 2.0);
nums.sort(Comparator.comparing(num -> order.get(nums.indexOf(num))));
System.out.println(nums);
edited May 16 at 10:19
answered May 16 at 10:01
LesiakLesiak
2,75411127
2,75411127
2
Results in[0.9, 5.0, 10.4], which is wrong
– Michael
May 16 at 10:07
add a comment |
2
Results in[0.9, 5.0, 10.4], which is wrong
– Michael
May 16 at 10:07
2
2
Results in
[0.9, 5.0, 10.4], which is wrong– Michael
May 16 at 10:07
Results in
[0.9, 5.0, 10.4], which is wrong– Michael
May 16 at 10:07
add a comment |
The Comparator you are supplying calls indexOf for every num passed.
The returned values are -1 on all calls, so the order is preserverd as-is.
You need to sort natural.
Sorting by another list of Double should be possible, but unnecessarily complicated, it would be simpler to provide a custom Object which sorts as desired.
add a comment |
The Comparator you are supplying calls indexOf for every num passed.
The returned values are -1 on all calls, so the order is preserverd as-is.
You need to sort natural.
Sorting by another list of Double should be possible, but unnecessarily complicated, it would be simpler to provide a custom Object which sorts as desired.
add a comment |
The Comparator you are supplying calls indexOf for every num passed.
The returned values are -1 on all calls, so the order is preserverd as-is.
You need to sort natural.
Sorting by another list of Double should be possible, but unnecessarily complicated, it would be simpler to provide a custom Object which sorts as desired.
The Comparator you are supplying calls indexOf for every num passed.
The returned values are -1 on all calls, so the order is preserverd as-is.
You need to sort natural.
Sorting by another list of Double should be possible, but unnecessarily complicated, it would be simpler to provide a custom Object which sorts as desired.
answered May 16 at 9:53
Stefan HelmerichsStefan Helmerichs
356415
356415
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f56165647%2fjava-comparator-comparing-not-comparing%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
I'm not understanding why are you trying to sort
numswithorders: looks like you simply wanna sortnums, why are you using order ?– Leviand
May 16 at 9:52
Just noticed I wrote it wrong, edited it.
– shakedzy
May 16 at 9:53
ok now make sense :)
– Leviand
May 16 at 9:55
For this to work, each
numselement must exist inorder– Logan Wlv
May 16 at 9:59