private void createEdges() {
        while (!nodeRefQueue.isEmpty()) {
            Long fn = nodeRefQueue.poll();
            if (!nodeRefQueue.isEmpty()) {
                Long tn = nodeRefQueue.peek();
                
                if (mappingNodesFirst && !idMap.isEmpty()) {
                    int mappedFN = idMap.get(fn);
                    int mappedTN = idMap.get(tn);
                    
                    OSMEdgeData edge = new OSMEdgeDataBuilder().setFNODE(mappedFN).setTNODE(mappedTN).setTYPE(typ).setID(vejnr).setNAME(vejnavn).setMAXSPEED(maxspeed).setONE_WAY(oneway).createOSMEdgeData();
                    processEdge(edge);
                    
                } else if (!mappingNodesFirst) {
                    if (!idMap.containsKey(tn)) {
                        idMap.put(tn, nodeIDCounter++);
                    }
                    if (!idMap.containsKey(fn)) {
                        idMap.put(fn, nodeIDCounter++);
                    }
                    
                    int mappedFN = idMap.get(fn);
                    int mappedTN = idMap.get(tn);
                    
                    OSMEdgeData edge = new OSMEdgeDataBuilder().setFNODE(mappedFN).setTNODE(mappedTN).setTYPE(typ).setID(vejnr).setNAME(vejnavn).setMAXSPEED(maxspeed).setONE_WAY(oneway).createOSMEdgeData();
                    processEdge(edge);
                }

            }
        }
    }