compareto
Using Collections.sort() to sort a list of MP3s
I\'m using Collections.sort() to sort a list of MP3s in order of runtime, and if runtime is equal, then sort alphabetically by title, and if title is equal then sort by composer. I put the input into[详细]
2023-03-09 12:20 分类:问答Problem with CompareTo
I am trying to implement a sorted list. I have created the class I want to have stored in the list, but for some reason when I try and run the sort the sort method I get an exception thrown. It appear[详细]
2023-03-06 17:56 分类:问答compareTo() and Collections.sort() Solution For Multiple Column Ordering (Ascending) question
Am somewhat confused with Java\'s compareTo() and Collections.sort() behavior. I am supposed to sort a column in ascending order using compareTo() & Collectio开发者_StackOverflow社区ns.sort().[详细]
2023-02-25 06:34 分类:问答Does compareTo have some sort of pre-launching delay?
I just found this statement: \"One can greatly increase the perform开发者_开发问答ance of compareTo by comparing first on items which are most likely to differ\". Is it true? And if it is, why?Conside[详细]
2023-02-14 09:01 分类:问答Java: Using Array.sort() error - java.lang.ClassCastException: Student cannot be cast to java.lang.Comparable
I am trying to write a program for my course that sorts an array of objects. Does anyone know why I am getting this error? Snippets of code included below![详细]
2023-01-31 02:17 分类:问答How to compare 2 objects of generic type
Is there a way to compare two objects that are generic? I\'m supposed to find the largest object in a linked list. My开发者_如何学编程 first guess was to use the Object\'s class compareTo method, but[详细]
2023-01-21 19:52 分类:问答How do I perform an encoding-independent string-comparison in Java?
I\'m having a strange problem comparing strings. I send a string to my server (as bytes using getBytes()) from the client. I\'ve ensured that encoding is the same on the client and server by starting[详细]
2023-01-18 04:48 分类:问答Java implementing comparator on ArrayList
I\'m quite new to Java so this is probably pretty straight forward question. I want to sort an ArrayList in the class MediaLib based on the natural order of a specified key.[详细]
2023-01-15 15:14 分类:问答Java's compareTo() function equivalent in Perl?
Wh开发者_如何转开发at\'s the Perl function that achieves the same thing as compareTo() in Java? I know about eq and ne but I want to compare to see if one string is greater than another.You actually h[详细]
2023-01-12 14:46 分类:问答how to customize compareTo method to consider both direction flow
if I need to customize my code with this logic if this.srcAddr=other.srcAddr or this.src.Addr = other.sdstAddr[详细]
2023-01-11 06:12 分类:问答
加载中,请稍侯......