public static <T> Stream<T> sync(Object lock, Stream<T> stream) {
		var wrapped = new SynchronizedSpliterator<T>(stream.spliterator(), lock);
		return StreamSupport.stream(wrapped, stream.isParallel());
	}
Wrap the given stream into a synchronized stream on the given object's intrinsic lock

<p>
<b>NOTE:</b> This makes no guarantees regarding the consistency or visit order if the
underlying resource is modified between elements being visited. It merely prevents the stream
client from accessing the underlying resource concurrently. For such guarantees, the client
may need to acquire the lock for its whole use of the stream.

@param <T> the type of elements
@param lock the object on which to synchronize
@param stream the (un)synchronized stream
@return the synchronized stream
Ghidra/Debug/ProposedUtils/src/main/java/ghidra/util/StreamUtils.java