You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Comparator
Interface IComparer from C# is not translated correctly. The generated Java class looks as follows:
public class PostProfileComparer extends IComparer
{
public int Compare( PostProfile x, PostProfile y) throws Exception {
return y.getScore().Compare(x.getScore());
}
}
but interface IComparer is not defined, and also method Compare is not defined on type int (the result type of method getScore()).
We haven't yet implemented the IComparer class. I will look into that.
When we do then y.GetScore() should be automatically cast to an
Integer before we call the Compare method.
The text was updated successfully, but these errors were encountered:
Or alternatively use the < > == comparison on the ints directly. Simply returning y.getScore() - x.getScore() would be a simple solution,
Unfortunately this is not safe regarding int overflows. I have translated it to
return y.getScore() == x.getScore() ? 0 : (y.getScore() > x.getScore() ? 1 : -1)
We haven't yet implemented the IComparer class. I will look into that.
When we do then y.GetScore() should be automatically cast to an
Integer before we call the Compare method.
The text was updated successfully, but these errors were encountered: