Well-named functions can allow the users of your code to understand at a glance what to expect from the function - even before reading the documentation. Toward that end, methods returning a boolean should have names that start with "is" or "has" rather than with "get".
public boolean getFoo() { // Noncompliant
// ...
}
public boolean getBar(Bar c) { // Noncompliant
// ...
}
public boolean testForBar(Bar c) { // Compliant - The method does not start by 'get'.
// ...
}
public boolean isFoo() {
// ...
}
public boolean hasBar(Bar c) {
// ...
}
public boolean testForBar(Bar c) {
// ...
}
Overriding methods are excluded.
@Override
public boolean getFoo(){
// ...
}