tag::result-retain[]
321517
public int addEmployees( final String companyName )
    {
        try ( Session session = driver.session() )
        {
            int employees = 0;
            List<Record> persons = session.readTransaction( new TransactionWork<List<Record>>()
            {
                @Override
                public List<Record> execute( Transaction tx )
                {
                    return matchPersonNodes( tx );
                }
            } );
            for ( final Record person : persons )
            {
                employees += session.writeTransaction( new TransactionWork<Integer>()
                {
                    @Override
                    public Integer execute( Transaction tx )
                    {
                        tx.run( "MATCH (emp:Person {name: $person_name}) " +
                                "MERGE (com:Company {name: $company_name}) " +
                                "MERGE (emp)-[:WORKS_FOR]->(com)",
                                parameters( "person_name", person.get( "name" ).asString(), "company_name",
                                        companyName ) );
                        return 1;
                    }
                } );
            }
            return employees;
        }
    }
899728
function cacheResults (result) {
    // JSON encode result
    try {
        var cacheValue = JSON.stringify(result)
    }
    catch (err) {
        // ignore errors
    }
    // cache value
    if (defined(cacheValue)) {
        // debug
        debug('view:id:collection:set', this.idCacheKey)
        // cache results
        return this.cache.redis.setAsync(this.idCacheKey, cacheValue)
    }
}
661126
def pass_result(db: JobDB, always_cache=False):
    """"""
    @pull
    def pass_result_stream(worker_source):
        """Pull stream instance created by `pass_result`."""
        for result in worker_source():
            if result is EndOfQueue:
                return

            attached = db.store_result_in_db(
                result, always_cache=always_cache)

            yield result
            yield from (ResultMessage(key, 'attached', result.value, None)
                        for key in attached)

    return pass_result_stream
1281050
function(callbackUUID, result) {
    var callback = apiListeners[callbackUUID];
    if (callback) {
      if ( !(result && result instanceof Array )) {
        if(window.console && console.error){
          console.error('received result is not an array.', result);
        }
      }
      callback.apply(this, result);
      delete apiListeners[callbackUUID];
    }
  }
123727
def result(self, result):
        
        if result and len(result[2]) > 0:
            self.errs.extend([((result[0], result[1]), err) for err in result[2]])
476832
function normalizeResult(result) {
  if (result.uri) {
    console.log('normalizing', result);
    if (!result._source) {
      result._source = {};
    }
    ['title', 'timestamp', 'uri', 'annotationSummary', 'annotations', 'visitors'].forEach(function(f) {
      result._source[f] = result[f];
    });
  }
  return result;
}
861902
public function taggedWith($tag)
    {
        $results = [];

        if (isset($this->tags[$tag]))
        {
            foreach ($this->tags[$tag] as $view)
            {
                $results[] = $view;
            }

        }

        return $results;
    }
1066885
public function tagged()
    {
        $result = false;

        /** @var Tag $tag */
        foreach ($this->repository->getTags() as $tag) {
            if ($tag->getSha() === $this->getSha()) {
                $result = true;
                break;
            }
        }

        return $result;
    }
1071206
List<Result> getResult() {
    return ImmutableList.copyOf(Iterables.filter(results.values(), USED_RESULTS));
  }
1064113
def all_h2
      result = []
      @pages.each do |page|
        result << [page.page_url, page.h2_text] unless page.page_a_tags
      end
      result
    end
739499
def add_result(key, text)
      if @result[key]
        if @result[key].is_a? Array
          @result[key].push(text)
        else
          @result[key] = [@result[key], text]
        end
      else
        @result[key] = text
      end
    end
362666
function getTemplateResultChunk(result, stack) {
  let chunk = result.readChunk();

  // Skip empty strings
  if (Buffer.isBuffer(chunk) && chunk.length === 0) {
    chunk = result.readChunk();
  }

  // Finished reading, dispose
  if (chunk === null) {
    stack.shift();
  } else if (isTemplateResult(chunk)) {
    // Add to top of stack
    stack.unshift(chunk);
    chunk = getTemplateResultChunk(chunk, stack);
  }

  return chunk;
}
197956
@Override
    public Result addTokenToResult(Context context, String newToken, Result result) {
        if (isCached(context)) {
            LOGGER.debug("Not adding token to a cached result");
            return result;
        }

        LOGGER.debug("Adding token to result");
        if (getCookieName() != null) {
            Cookie cookie = context.cookie(getCookieName());
            if (cookie != null) {
                return result.with(Cookie.builder(cookie).setValue(newToken).build());
            } else {
                // Create a new cookie
                return result.with(Cookie.cookie(getCookieName(), newToken)
                        .setSecure(isSecureCookie())
                        .setPath(getCookiePath())
                        .setDomain(getCookieDomain())
                        .setMaxAge(3600)
                        .build());
            }
        } else {
            // Session
            context.session().put(getTokenName(), newToken);
            return result;
        }
    }
454518
function ReturnResult(result) {
  if (errors.length) {
    result.errors = errors;
  }
  var state = data.state;
  if (state) {
    var AMS = MathJax.Extension["TeX/AMSmath"];
    var GLYPH = (MathJax.OutputJax.SVG||{}).BBOX.GLYPH;
    state.AMS.startNumber = AMS.startNumber;
    state.AMS.labels = AMS.labels;
    state.AMS.IDs = AMS.IDs;
    state.mmlID = MathJax.ElementJax.mml.SUPER.ID;
    state.glyphs = GLYPH.glyphs;
    state.defs = GLYPH.defs;
    state.n = GLYPH.n;
    state.ID = ID;
  }
  serverState = STATE.READY;
  callback(result, originalData);
  if (serverState === STATE.READY) StartQueue();
}
1047869
def _persist_result(self):
        """"""
        self._prepare_persistence_engine()

        return self._persistence_engine.store_async_result(
            self.id, self.result)
1341149
@Override
	public boolean retainAll(Collection<?> collection) {
		if (booleanTerms == null) {
			return false;
		}
		return booleanTerms.retainAll(collection);
	}
204708
protected function collectionFromResult($result)
    {
        // If we have one result which is not an assoc array, make it the first element of an array for the
        // collectionFromResult function so we always return a collection from filter
        if ((bool) count(array_filter(array_keys($result), 'is_string'))) {
            $result = [$result];
        }

        $class = $this->class;
        $collection = [];

        foreach ($result as $r) {
            $collection[] = new $class($this->connection, $r);
        }

        return $collection;
    }