void mergeBlocks(List<MemoryBlock> blocks) {
		// need to order by start address
		Collections.sort(blocks, (b1, b2) -> b1.getStart().compareTo(b2.getStart()));
		if (!goodBlocks(blocks)) {
			return;
		}

		MergeBlocksCmd cmd = new MergeBlocksCmd(blocks);
		if (!tool.execute(cmd, program)) {
			Msg.showError(getClass(), plugin.getMemoryMapProvider().getComponent(),
				"Merge Blocks Failed", cmd.getStatusMsg());
		}
	}
Callback for merging blocks of memory
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/memory/MemoryMapManager.java