Source:
<code>public static <K, V, C extends Serializable> void initContext( Ignite ignite, String upstreamCacheName, UpstreamTransformerBuilder<K, V> transformerBuilder, IgniteBiPredicate<K, V> filter, String datasetCacheName, PartitionContextBuilder<K, V, C> ctxBuilder, LearningEnvironmentBuilder envBuilder, int retries, int interval) { affinityCallWithRetries(ignite, Arrays.asList(datasetCacheName, upstreamCacheName), part -> { Ignite locIgnite = Ignition.localIgnite(); LearningEnvironment env = envBuilder.buildForWorker(part); IgniteCache<K, V> locUpstreamCache = locIgnite.cache(upstreamCacheName); ScanQuery<K, V> qry = new ScanQuery<>(); qry.setLocal(true); qry.setPartition(part); qry.setFilter(filter); C ctx; UpstreamTransformer<K, V> transformer = transformerBuilder.build(env); <START> UpstreamTransformer<K, V> transformerCopy = Utils.copy(transformer); <END> long cnt = computeCount(locUpstreamCache, qry, transformer); try (QueryCursor<UpstreamEntry<K, V>> cursor = locUpstreamCache.query(qry, e -> new UpstreamEntry<>(e.getKey(), e.getValue()))) { Iterator<UpstreamEntry<K, V>> it = cursor.iterator(); Stream<UpstreamEntry<K, V>> transformedStream = transformerCopy.transform(Utils.asStream(it, cnt)); it = transformedStream.iterator(); Iterator<UpstreamEntry<K, V>> iter = new IteratorWithConcurrentModificationChecker<>( it, cnt, "Cache expected to be not modified during dataset data building [partition=" + part + ']'); ctx = ctxBuilder.build(env, iter, cnt); } IgniteCache<Integer, C> datasetCache = locIgnite.cache(datasetCacheName); datasetCache.put(part, ctx); return part; }, retries, interval); }</code><technical_language>please clarify need a copy here</technical_language>

Target:
public static <K, V, C extends Serializable> void initContext( Ignite ignite, String upstreamCacheName, UpstreamTransformerBuilder<K, V> transformerBuilder, IgniteBiPredicate<K, V> filter, String datasetCacheName, PartitionContextBuilder<K, V, C> ctxBuilder, LearningEnvironmentBuilder envBuilder, int retries, int interval) { affinityCallWithRetries(ignite, Arrays.asList(datasetCacheName, upstreamCacheName), part -> { Ignite locIgnite = Ignition.localIgnite(); LearningEnvironment env = envBuilder.buildForWorker(part); IgniteCache<K, V> locUpstreamCache = locIgnite.cache(upstreamCacheName); ScanQuery<K, V> qry = new ScanQuery<>(); qry.setLocal(true); qry.setPartition(part); qry.setFilter(filter); C ctx; UpstreamTransformer<K, V> transformer = transformerBuilder.build(env); UpstreamTransformer<K, V> transformerCp = Utils.copy(transformer); long cnt = computeCount(locUpstreamCache, qry, transformer); try (QueryCursor<UpstreamEntry<K, V>> cursor = locUpstreamCache.query(qry, e -> new UpstreamEntry<>(e.getKey(), e.getValue()))) { Iterator<UpstreamEntry<K, V>> it = cursor.iterator(); Stream<UpstreamEntry<K, V>> transformedStream = transformerCp.transform(Utils.asStream(it, cnt)); it = transformedStream.iterator(); Iterator<UpstreamEntry<K, V>> iter = new IteratorWithConcurrentModificationChecker<>( it, cnt, "Cache expected to be not modified during dataset data building [partition=" + part + ']'); ctx = ctxBuilder.build(env, iter, cnt); } IgniteCache<Integer, C> datasetCache = locIgnite.cache(datasetCacheName); datasetCache.put(part, ctx); return part; }, retries, interval); }