boolean started = false; boolean diff = false, oldDiff = false;  for ( Iterator itr = pg2.getPoints( ).iterator( ); itr.hasNext( ); )
if ( pg1 != null )
	public static boolean intersects( Polygon pg1, Polygon pg2 )	{		// TODO this is just a simple implementation for clip test. May only		// works for convex polygon.		boolean started = false;		boolean diff = false, oldDiff = false;		for ( Iterator itr = pg2.getPoints( ).iterator( ); itr.hasNext( ); )		{			Point pt = (Point) itr.next( );			diff = pg1.contains( pt );			if ( !started )			{				started = true;				oldDiff = diff;			}			if ( diff != oldDiff )			{				return true;			}			oldDiff = diff;		}		if ( diff )		{			return true;		}		if ( pg1.getPoints( ).size( ) > 0 )		{			return pg2.contains( pg1.getPoint( 0 ) );		}		return false;	}