I also like to mention that introducing instance variables like this could be a source of danger if the used functions have side effects you didn't see.
Something like:
if (isSomethingWithoutSideEffects() && isSomethingWithSideEffects()) {
// stuff
}
Here the isSomethingWithSideEffects() will only be executed if the first isSomethingWithoutSideEffects() evaluates to true
while:
boolean first = isSomethingWithoutSideEffects();
boolean second = isSomethingWithSideEffects();
will both be executed.
Have a nice evening :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I liked the Article. Thank you for that.
I also like to mention that introducing instance variables like this could be a source of danger if the used functions have side effects you didn't see.
Something like:
if (isSomethingWithoutSideEffects() && isSomethingWithSideEffects()) {
// stuff
}
Here the isSomethingWithSideEffects() will only be executed if the first isSomethingWithoutSideEffects() evaluates to true
while:
boolean first = isSomethingWithoutSideEffects();
boolean second = isSomethingWithSideEffects();
will both be executed.
Have a nice evening :)