private static void findIntersection(Map<String, LineString> linesByName) {
        for (Entry<String, LineString> entryA : linesByName.entrySet()) {
            for (Entry<String, LineString> entryB : linesByName.entrySet()) {
                System.out.println("Checking " + entryA.getKey() + " against "
                        + entryB.getKey());
                if (entryA.equals(entryB))
                    continue;
                // TODO: Introduce PreparedGeometry
                if (entryA.getValue().intersects(entryB.getValue())) {
                    System.out.println(entryA.getKey() + " intersects "
                            + entryB.getKey());
                    lineStringToJSON(entryA);
                    lineStringToJSON(entryB);
                    System.out
                            .println("Intersection is "
                                    + entryA.getValue().intersection(
                                            entryB.getValue()));
                    System.exit(0);
                }
            }
        }
    }
private static void findIntersection(Map<String, LineString> linesByName) {
        for (Entry<String, LineString> entryA : linesByName.entrySet()) {
            for (Entry<String, LineString> entryB : linesByName.entrySet()) {
                System.out.println("Checking " + entryA.getKey() + " against "
                        + entryB.getKey());
                if (entryA.equals(entryB))
                    continue;
               
                if (entryA.getValue().intersects(entryB.getValue())) {
                    System.out.println(entryA.getKey() + " intersects "
                            + entryB.getKey());
                    lineStringToJSON(entryA);
                    lineStringToJSON(entryB);
                    System.out
                            .println("Intersection is "
                                    + entryA.getValue().intersection(
                                            entryB.getValue()));
                    System.exit(0);
                }
            }
        }
    }
private static void findintersection(map<string, linestring> linesbyname) { for (entry<string, linestring> entrya : linesbyname.entryset()) { for (entry<string, linestring> entryb : linesbyname.entryset()) { system.out.println("checking " + entrya.getkey() + " against " + entryb.getkey()); if (entrya.equals(entryb)) continue; if (entrya.getvalue().intersects(entryb.getvalue())) { system.out.println(entrya.getkey() + " intersects " + entryb.getkey()); linestringtojson(entrya); linestringtojson(entryb); system.out .println("intersection is " + entrya.getvalue().intersection( entryb.getvalue())); system.exit(0); } } } }