Code example for PriorityQueue

Methods: remove

0
    } 
 
    private void remove(PortRange candidate) {
        this.portRangeLowboundMap.remove(candidate.getLowerBound());
        this.portRangeHighboundMap.remove(candidate.getHigherBound());
        this.portRangeQueue.remove(candidate);
    } 
 
    private void insert(PortRange portRange) {
        int highbound = portRange.getHigherBound();
        PortRange rightNeighbor = this.portRangeLowboundMap.get(highbound);
        PortRange leftNeighbor = this.portRangeHighboundMap.get(portRange
                .getLowerBound()); 
 
        if (rightNeighbor != null) {
            portRange.setHigherBound(rightNeighbor.getHigherBound());
            this.remove(rightNeighbor);
        } 
 
        if (leftNeighbor != null) {
            portRange.setLowerBound(leftNeighbor.getLowerBound());