I would say both those Comparator λs are incorrect. The range of arguments they are being tested on is too small to detect the error. You can read about object ordering in the Java™ Tutorials, which will tell you the correct thing to write. You can simply write Comparator<Integer> comp = Comparator.naturalOrder(); beausee Integer has a natural ordering.Mike Simmons wrote:. . . they work fine for this problem.
There isn't an overloading of that name taking Object as an argument. It will take a String, however, so change to writer.write(s.toString());sai rama krishna wrote:. . .
. . .The method write(int) in the type BufferedWriter is not applicable for the arguments (Object)
That sounds very confused; you don't grab a method but use the method reference to instrut the λ what to do. Saying, “class object” suggests you don't understand where the method it. I suspect it is static and therefor doesn't involve an object at all.tangara goh wrote:. . . i just have to grab the method reference from the Object in this case is it s method that is coming from FizzBuzz the class object.
That's a pleasureThanks.
It means, “method reference.”tangara goh wrote:
. . . function call . . . .Ira Go wrote:. . . function call . . .
Change it to U If you look up Unicode, you will find that 55 is U. Hexadecimal numbers, of course.tangara goh wrote:Please note "U" is not allowed so i have no choice but to changed it to YOU
That's a pleasureAb Burda wrote:. . . thank you for your time. . . .
Bit‑twiddling is never straightforward. But let me repeat what I have said several time already: do arithmetic, which I am taking to include bit‑twiddling, with ints and longs only.Ira Go wrote:. . . Bit handling in Java is not straight-forward. . . .
Ira Go wrote:. . . is there any way to do unsigned right shift on a byte, for example, just with >>> in one go? . . .
All arithmetic operators use promotion.Ira Go wrote:. . . (or any other binary numeric operator, in this case). They follow numeric promotion
Why would you want to do arithmetic, including shifts, on a byte? Confine your use of byte and shorts to certification exams and only use ints and longs for arithmetic. On the other hand, a byte[] is something useful because you can send it across a network.. . . is there any way to do unsigned right shift on a byte, for example, just with >>> in one go?