public static void main(final String[] args) {
        final OsmNode[] nodes = new OsmNode[12];
        for (int i = 0; i < nodes.length; i++) {
            nodes[i] = new OsmNode((i + 1000) * 1000, (i + 1000) * 1000);

        }

        addLinks(nodes, 0, true, new int[]{1, 5});  // 0
        addLinks(nodes, 1, true, new int[]{});  // 1
        addLinks(nodes, 2, false, new int[]{3, 4});  // 2
        addLinks(nodes, 3, false, new int[]{4});  // 3
        addLinks(nodes, 4, false, new int[]{});  // 4
        addLinks(nodes, 5, true, new int[]{6, 9});  // 5
        addLinks(nodes, 6, false, new int[]{7, 8});  // 6
        addLinks(nodes, 7, false, new int[]{});  // 7
        addLinks(nodes, 8, false, new int[]{});  // 8
        addLinks(nodes, 9, false, new int[]{10, 11});  // 9
        addLinks(nodes, 10, false, new int[]{11});  // 10
        addLinks(nodes, 11, false, new int[]{});  // 11

        final OsmNodesMap nm = new OsmNodesMap();

        nm.cleanupMode = 2;

        nm.cleanupAndCount(nodes);

        System.out.println("nodesCreated=" + nm.nodesCreated);
        nm.cleanupAndCount(nodes);

        System.out.println("nodesCreated=" + nm.nodesCreated);

    }
Container for link between two Osm nodes

@author ab
main/src/main/java/cgeo/geocaching/brouter/mapaccess/OsmNodesMap.java