Remove Double Negative

Refactoring contributed by Ashley Frieze and Martin Fowler

You have a double negative conditional.

Make it a single positive conditional

 if ( !item.isNotFound() )

 if ( item.isFound() )

Motivation

Double negatives are often frowned on by mavens of natural language. Often this frowning is inappropriate - certainly in English the double negative has its uses.

But that is not true in programming. There double negatives are just plain confusing. So kill them on sight.

Mechanics

| Refactoring Home | | Alphabetical List |