public static synchronized void recycle(Rectangle r){
  if (pool.size() >= MAX_POOL_SIZE || r == null) {
    return;
  }
  pool.add(r);
}

public static synchronized void recycle ( Rectangle r ) { if ( pool . size ( ) >= MAX_POOL_SIZE || r == null ) { return ; } pool . add ( r ) ; }
returns the given rectangle to the object pool .
