public boolean contains ( Rect r ) { // check for empty first return this . left < this . right && this . top < this . bottom // now check for containment && left <= r . left && top <= r . top && right >= r . right && bottom >= r . bottom ; }
Returns true iff the specified rectangle r is inside or equal to this rectangle . An empty rectangle never contains another rectangle .