Skip to content
Advertisement

Tag: sorting

What’s wrong with my In Place Heap Sorting code

I’m working on a school assignment and the assignment was to make a heap sorting (In Place) program. Now the program works perfectly fine for arrays with under +- 20 elements, above that it occasionally messes up, however I can’t seem to find what’s wrong. The skeleton for the methods was already there so if you’re asking why certain parameters

Java sorting is not the same with MySQL sorting

I need to check the sorting in the table and table content is given by MySQL. I’m trying the following: Collections.sort(sorted, String.CASE_INSENSITIVE_ORDER); And get the following result: tes3@test.com test4@test.com test5@test.com test@test.com test_user@mail.com user-og@driver.com And this is what I get from MySQL by query: SELECT ’email’ FROM ‘user’ WHERE 1 ORDER BY ‘user’.’email’ ASC : tes3@test.com test_user@mail.com test@test.com test4@test.com test5@test.com user-og@driver.com

Fastest way to sort an array of objects in java

I have a Class called apple which contains 3 values as int x, int y and int weight. Then i created an array of apple type objects. Now i want to sort the the array of objects based on weight meaning the the apple object with the lowest weight should be first and so on. I know there are quite

How to sort dates of type string in java

I am building a android project where am storing some details which includes date as string,but now I need to sort the list view by date.I am bit confused on how to do it.I am done with everything but need to sort the list by date. Here is the overview of how am storing data. I have an arraylist of

Disable Column Header sorting on a JTable

Is it possible to disable manual sorting on a JTable after adding a sorter? So I have a JTable that has the following sorter attached to it (basically sorts by column 3 when the table is initialised): This works fine, however the user is still able to click on the column headers in the table and sort by any of

How to sort an array of objects in Java?

My array does not contain any string. But its contains object references. Every object reference returns name, id, author and publisher by toString method. Now I need to sort that array of objects by the name. I know how to sort, but I do not know how to extract the name from the objects and sort them. Answer You have

How to sort file names in ascending order?

I have a set of files in a folder, and all of them starting with a similar name, except one. Here is an example: I am able to list all the files from the specified folder, but the list is not in an ascending order of the spectrum number. Example: I get the following result when the program is executed:

Advertisement