public boolean updateRange(@NonNull final Range oldRange, @NonNull final Range newRange) {
        int index;
        if (oldRange instanceof AllocatedUnicastRange) {
            index = allocatedUnicastRanges.indexOf((AllocatedUnicastRange) oldRange);
            if (index > -1) {
                final AllocatedUnicastRange exitingRange = allocatedUnicastRanges.get(index);
                allocatedUnicastRanges.set(index, (AllocatedUnicastRange) newRange);
                //Let's merge if there is any overlapping
                final ArrayList<AllocatedUnicastRange> ranges = new ArrayList<>(allocatedUnicastRanges);
                Collections.sort(ranges, addressRangeComparator);
                allocatedUnicastRanges.clear();
                allocatedUnicastRanges.addAll(Range.mergeUnicastRanges(ranges));
                return true;
            }
        } else if (oldRange instanceof AllocatedGroupRange) {
            index = allocatedGroupRanges.indexOf((AllocatedGroupRange) oldRange);
            if (index > -1) {
                final AllocatedGroupRange exitingRange = allocatedGroupRanges.get(index);
                allocatedGroupRanges.set(index, (AllocatedGroupRange) newRange);
                //Let's merge if there is any overlapping
                final ArrayList<AllocatedGroupRange> ranges = new ArrayList<>(allocatedGroupRanges);
                Collections.sort(ranges, addressRangeComparator);
                allocatedGroupRanges.clear();
                allocatedGroupRanges.addAll(Range.mergeGroupRanges(ranges));
                return true;
            }
        } else if (oldRange instanceof AllocatedSceneRange) {
            index = allocatedSceneRanges.indexOf((AllocatedSceneRange) oldRange);
            if (index > -1) {
                final AllocatedSceneRange exitingRange = allocatedSceneRanges.get(index);
                allocatedSceneRanges.set(index, (AllocatedSceneRange) newRange);
                //Let's merge if there is any overlapping
                final ArrayList<AllocatedSceneRange> ranges = new ArrayList<>(allocatedSceneRanges);
                Collections.sort(allocatedSceneRanges, sceneRangeComparator);
                allocatedSceneRanges.clear();
                allocatedSceneRanges.addAll(Range.mergeSceneRanges(ranges));
                return true;
            }
        }
        return false;
    }
Edit an existing range

@param oldRange Old range
@param newRange New range
mesh/src/main/java/no/nordicsemi/android/mesh/Provisioner.java