Java tutorial
import java.awt.geom.Line2D; public class Main { /** * Compares two lines are returns <code>true</code> if they are equal or * both <code>null</code>. * * @param l1 the first line (<code>null</code> permitted). * @param l2 the second line (<code>null</code> permitted). * * @return A boolean. */ public static boolean equal(final Line2D l1, final Line2D l2) { if (l1 == null) { return (l2 == null); } if (l2 == null) { return false; } if (!l1.getP1().equals(l2.getP1())) { return false; } if (!l1.getP2().equals(l2.getP2())) { return false; } return true; } }