Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Java array list from a class

soniajain

Newbie
Joined
May 15, 2023
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
United States
Activity points
33
Hi everybody!

I need to sort an Array List from a class.
I did this with "Collections.sort(ArrayList);" tried.
Yet, that doesn't work since it is by all accounts some unacceptable data type.
Double values are stored in this array list.

How could you at any point respond there?
 
that doesn't work since it is by all accounts some unacceptable data type.
One would expect to see the code and the specific compiler error you are talking about, not the narrative about whatever you meant.
Anyway, are you trying to sort values from different types?
 
By default, the sort() function sorts the values in string order. This function works great for strings ("apple" will come before "banana").
However, if the numbers are sorted by string, "25" is greater than "100" because "2" is greater than "1". Therefore, the sort() method may produce incorrect results when sorting numeric values.

[MODERATOR ACTION]

Translated to English
 
Last edited by a moderator:

LaTeX Commands Quick-Menu:

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top