File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes ArrayList sorting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "ArrayList sorting" Watch "ArrayList sorting" New topic
Author

ArrayList sorting

Jeansonne Pierre
Greenhorn

Joined: Sep 11, 2011
Posts: 12


this code compiled succeed, but come out with warning message as below

Note: .\Sorting.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.


which part of code should i modify or improve to remove the warning messages?

Please help.
Thanks in advance
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7029
    
  16

Jeansonne Pierre wrote:which part of code should i modify or improve to remove the warning messages?

Add a type to your Arraylist, viz:
ArrayList<Double> arrayList = new ArrayList<Double>();

Winston

Isn't it funny how there's always time and money enough to do it WRONG?
Artlicles by Winston can be found here
Jeansonne Pierre
Greenhorn

Joined: Sep 11, 2011
Posts: 12
Thanks Winston Gutkowski,

the warning messages gone and it succeed.

anyway, I'm wondering why it is

instead of ?

as the method argument received is in double primitive type.
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7029
    
  16

Jeansonne Pierre wrote:anyway, I'm wondering why it is

as the method argument received is in double primitive type.

Because types must be objects. An ArrayList can't hold doubles.

Winston
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ArrayList sorting
 
Similar Threads
Generics Generics Generics !!!
Problem in sorting data in Richface DataTable
Sorting version numbers
Problem with sorting an integer array
Array problem