private boolean equalRefArrays(ProgramDiff programDiff, Reference[] refs1, Reference[] refs2) {
		if (refs1 == refs2)
			return true;
		if (refs1 == null || refs2 == null)
			return false;

		int length = refs1.length;
		if (refs2.length != length)
			return false;

		for (int i = 0; i < length; i++) {
			Reference ref1 = refs1[i];
			Reference ref2 = refs2[i];
			// If the references are external refs, see if they map to the same thing.
			if (ref1.isExternalReference() && ref2.isExternalReference()) {
				if (!ref1.getReferenceType().equals(ref2.getReferenceType())) {
					return false;
				}
				Program programOne = programDiff.getProgramOne();
				Program programTwo = programDiff.getProgramTwo();
				Address toAddress1 = ref1.getToAddress();
				Address toAddress2 = ref2.getToAddress();
				Symbol symbol1 = programOne.getSymbolTable().getPrimarySymbol(toAddress1);
				Symbol symbol2 = programTwo.getSymbolTable().getPrimarySymbol(toAddress2);
				long id1 = (symbol1 != null) ? symbol1.getID() : -1;
				long id2 = (symbol2 != null) ? symbol2.getID() : -1;
				try {
					long resultID1 = getResultID(programOne, id1);
					long resultID2 = getResultID(programTwo, id2);
					if (resultID1 == resultID2) {
						// Both references resolved to the same external.
						Msg.trace(this, "!!! Both references resolved to the same external. !!!");
						// Note: The reference source could still be different, but we will just keep what is in Result.
						continue;
					}
					return false;
				}
				catch (NoValueException e) {
					return false;
				}
			}

			// Otherwise they didn't map to the same so compare them.
			if (!programDiff.equalRefs(ref1, ref2)) {
				return false;
			}
		}

		return true;
	}
Merges the references from the same program that had its code units chosen
in the Code Unit merge phase.
@param monitor the task monitor for allowing cancel and showing progress.
@throws CancelledException if the user cancels the merge.
Ghidra/Features/Base/src/main/java/ghidra/app/merge/listing/ReferenceMerger.java