private static boolean containedIn(final Rectangle2D r,final Collection<Polygon> shapes){
  for (  final Shape item : shapes) {
    if (item.contains(r)) {
      return true;
    }
  }
  return false;
}

private static boolean containedIn ( final Rectangle2D r , final Collection < Polygon > shapes ) { for ( final Shape item : shapes ) { if ( item . contains ( r ) ) { return true ; } } return false ; }
java . lang . boolean containedin ( java . awt . geom . rectangle2d , java . tools . collection ) function to test if the given 2d rectangle is contained in any of the given shapes in the collection .
