private void consolidateRange(long rangeKey, long end) throws IOException {

		// Find map entries which occupy range
		Field[] mapKeys = mapTable.findRecords(new LongField(rangeKey), MAP_RANGE_KEY_COL);
		Field[] values = getMapValues(mapKeys);

		// Delete range if not occupied
		if (mapKeys.length == 0) {
			rangeTable.deleteRecord(rangeKey);
			return;
		}

		// Consolidate previous range if possible
		DBRecord rangeRec = rangeTable.getRecordBefore(rangeKey);
		if (rangeRec != null && rangeRec.getLongValue(RANGE_TO_COL) == (rangeKey - 1)) {
			Field[] keys = mapTable.findRecords(rangeRec.getKeyField(), MAP_RANGE_KEY_COL);
			// Can consolidate if range occupied by the same set of values
			if (Arrays.equals(getMapValues(keys), values)) {

				// Combine ranges
				rangeTable.deleteRecord(rangeKey);
				rangeRec.setLongValue(RANGE_TO_COL, end);
				rangeTable.putRecord(rangeRec);

				// Delete Map entries on old rangeKey
				for (int i = 0; i < mapKeys.length; i++) {
					mapTable.deleteRecord(mapKeys[i]);
				}

				rangeKey = rangeRec.getKey();
			}
		}

		// Consolidate next range if possible
		rangeRec = rangeTable.getRecordAfter(end);
		if (rangeRec != null && rangeRec.getKey() == (end + 1)) {
			Field[] keys = mapTable.findRecords(rangeRec.getKeyField(), MAP_RANGE_KEY_COL);
			// Can consolidate if range occupied by the same set of values
			if (Arrays.equals(getMapValues(keys), values)) {

				// Combine ranges
				rangeTable.deleteRecord(rangeRec.getKey());
				rangeRec.setKey(rangeKey);
				rangeTable.putRecord(rangeRec);

				// Delete Map entries on old rangeKey
				for (int i = 0; i < keys.length; i++) {
					mapTable.deleteRecord(keys[i]);
				}
			}
		}

	}
If other values are mapped to a specified range, perform a consolidation
on that range if possible.  If no reference exists, delete the range.
@param rangeKey
@param end end of range (must agree with record).
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/util/SharedRangeMapDB.java