Top "Compareto" questions

The CompareTo method is found in the .NET Framework and Java and imposes the natural ordering of a class.

What is string lexicographically? Java

The compareTo() method in Java compares two strings "lexicographically". Can someone please simply explain how the lexicographic comparison works in …

java string compareto
How can I calculate age in Java accurately given Date of birth

I am trying to calculate age in java that accounts for months, so just subtracting years will not work. I …

java android date calendar compareto
How to sort an array of objects containing null elements?

In my program an array fClasses of fixed length [7] of objects is created, each object is a class FClass that …

java arrays sorting compareto
Understanding TreeSet when compareto returns 0

I have created a Student class like this: public class Student implements Comparable<Student> { private String firstName; private …

java collections compareto treeset sortedset
cannot be cast to [Ljava.lang.Comparable

So I need to do dynamic ordered list. public class DynArrayListOrd<T extends Comparable<T>> { private …

java compareto
Objects added to a PriorityQueue are not ordered by their priority

I'm trying to implement a heap using a PriorityQueue as follows: PriorityQueue<Node> heap = new PriorityQueue<Node&…

java heap priority-queue compareto
java Float: == equals compareTo

I have 2 questions. 1) I was told that when comparing two Float or Double data, use compareTo instead of equals. I …

java equals compareto
Undocumented String.compareTo(null) NPE?

The following little test throws an NPE: public class Test { public static void main(String[] args) { String a = "a"; String …

java string null compareto
Override CompareTo: What to do with null case?

What should be returned in a CompareTo method when the given object is null? The MSDN Library shows a example …

c# compareto
Using PowerShell to find the differences in strings

So I'm playing around with Compare-Object, and it works fine for comparing files. But what about just strings? Is there …

string powershell compareto difference compareobject