private boolean goodBlocks(List<MemoryBlock> blocks) {
		// check that blocks are contigous (no other blocks in between)
		//    throw error if blocks in between
		Class<?> bc = null;
		long space_size = 0;
		for (int i = 0; i < (blocks.size() - 1); i++) {
			MemoryBlock blockA = blocks.get(i);
			MemoryBlock blockB = blocks.get(i + 1);
			if (bc == null) {
				bc = blockA.getClass();
			}
			if (bc != blockA.getClass() || bc != blockB.getClass()) {
				Msg.showError(this, plugin.getMemoryMapProvider().getComponent(),
					"Merge Blocks Failed",
					"Can't merge blocks because all block types are not the same");
				return false;
			}

			// make sure that the block after the first block is the second block
			Address nextStart = blockA.getEnd();
			AddressSpace space = nextStart.getAddressSpace();
			if (space.isOverlaySpace() && space.isNonLoadedMemorySpace()) {
				// impose convention-based restriction
				Msg.showError(this, plugin.getMemoryMapProvider().getComponent(),
					"Merge Blocks Failed", "Cannot merge OTHER overlay blocks");
				return false;
			}

			Address blockBstart = blockB.getStart();
			if (!space.isSuccessor(nextStart, blockBstart)) {
				try {
					Address a = nextStart.addNoWrap(1);
					MemoryBlock b = program.getMemory().getBlock(a);
					if (b != null) {
						Msg.showError(this, plugin.getMemoryMapProvider().getComponent(),
							"Merge Blocks Failed",
							"Can't merge blocks because they are not contiguous");
						return false;
					}
					else if (blockA.getType() == MemoryBlockType.BIT_MAPPED) {
						Msg.showError(this, plugin.getMemoryMapProvider().getComponent(),
							"Merge Blocks Failed",
							"Can't merge Bit Memory Blocks because they do not\n" +
								"have successive block end and block start addresses.");
						return false;
					}

				}
				catch (AddressOverflowException e) {
				}
			}

			try {
				space_size += blockBstart.subtract(blockA.getEnd());
			}
			catch (IllegalArgumentException e) {
				Msg.showError(this, plugin.getMemoryMapProvider().getComponent(),
					"Merge Blocks Failed", e.getMessage(), e);
				return false;
			}
		}

		// check that this won't create a large area between the address spaces
		if (space_size > 4 * 1024 * 1024) {
			int option = OptionDialog.showOptionDialog(plugin.getMemoryMapProvider().getComponent(),
				"Merge Memory Blocks",
				"Merging these blocks will create " + space_size / 1024 +
					"K extra bytes in memory.\n" +
					"Do you really want to merge the selected Memory Block(s)?",
				"Merge Blocks", OptionDialog.QUESTION_MESSAGE);
			if (option == 0) {
				return false;
			}
		}
		return true;
	}
Callback for merging blocks of memory
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/memory/MemoryMapManager.java