Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does <- mean in Java?

Tags:

java

I ran across this example and realized i don't fully understand what's going on here

if (a <- b) {
    return false;
}

What is <- in Java?

like image 818
James Raitsev Avatar asked May 14 '13 16:05

James Raitsev


People also ask

What is -> used for in Java?

To support lambdas, Java has introduced a new operator “->”, also known as lambda operator or arrow operator. This arrow operator is required because we need to syntactically separate the parameter from the body. LambdaBody can be an expression or a block.

What does <= in Java mean?

Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true. (A >= B) is not true. <= (less than or equal to) Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true.

What does || and && mean in Java?

&& is AND where as || is OR operator. && looks for false, means if first argument false, it wont test second whether it is true or false. || looks for true, means even though first argument false, it test for second. If both are false then false otherwise true. In && case both are true then true otherwise false.


2 Answers

See it in this way:

if (a < -b) {
    return false;
}

There is no <- operator in java.

Related, I've just found this question: What is the "-->" operator in C++?

like image 86
Alberto Zaccagni Avatar answered Sep 17 '22 20:09

Alberto Zaccagni


There is no such operator in java. This means

if (a < -b) {

}

which is same as

if (a < -         b) {

}

The - sign need not be just by b.

For int types one could do

if (a <-- b) {

}

which will be same as

if (a < --b) {

}
like image 23
fastcodejava Avatar answered Sep 18 '22 20:09

fastcodejava