Codota Logo
Lambdas
Code IndexAdd Codota to your IDE (free)

How to use
Lambdas
in
sirius.kernel.commons

Best Java code snippets using sirius.kernel.commons.Lambdas (Showing top 3 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ArrayList a =
  • Codota Iconnew ArrayList<String>()
  • Codota Iconnew ArrayList()
  • Codota Iconnew ArrayList<Object>()
  • Smart code suggestions by Codota
}
origin: com.scireum/sirius-db

@SuppressWarnings("unchecked")
@Override
protected Object transformFromDatasource(Class<? extends BaseMapper<?, ?, ?>> mapperType, Value object) {
  if (mapperType != Mango.class) {
    throw new UnsupportedOperationException(
        "MultiPointLocationProperty currently only supports Mango as mapper!");
  }
  List<Tuple<Double, Double>> locations = new ArrayList<>();
  if (!object.isNull()) {
    Object coordinates = ((Document) object.get()).get("coordinates");
    if (coordinates instanceof List<?>) {
      ((List<List<Double>>) coordinates).stream()
                       .map(entry -> Tuple.create(entry.get(0), entry.get(1)))
                       .collect(Lambdas.into(locations));
    }
  }
  return locations;
}
origin: com.scireum/sirius-kernel

/**
 * Returns a list of two-letter codes enumerating all supported languages. Provided via the config in
 * {@code nls.languages}
 *
 * @return a list of supported language codes
 */
public static Set<String> getSupportedLanguages() {
  if (supportedLanguages == null && Sirius.getSettings() != null) {
    try {
      supportedLanguages = Sirius.getSettings()
                    .getStringList("nls.languages")
                    .stream()
                    .map(String::toLowerCase)
                    .collect(Lambdas.into(Sets.newLinkedHashSet()));
    } catch (Exception e) {
      Exceptions.handle(e);
    }
  }
  // Returns the default language or (for very early access we default to en)
  return supportedLanguages == null ?
      Collections.singleton("en") :
      Collections.unmodifiableSet(supportedLanguages);
}
origin: com.scireum/sirius-search

private boolean processBlock(Function<? super E, Boolean> consumer,
               Limit lim,
               TaskContext ctx,
               RateLimit rateLimit,
               Set<String> entityDeDuplicator) throws Exception {
  SearchRequestBuilder srb = buildSearch();
  if (IndexAccess.LOG.isFINE()) {
    IndexAccess.LOG.FINE("PAGED-SEARCH: %s.%s: %s",
               indexAccess.getIndex(clazz),
               indexAccess.getDescriptor(clazz).getType(),
               buildQuery());
  }
  ResultList<E> resultList = transform(srb);
  for (E entity : resultList) {
    try {
      if (!processEntity(consumer, lim, ctx, rateLimit, entityDeDuplicator, entity)) {
        return false;
      }
    } catch (Exception e) {
      Exceptions.handle().to(IndexAccess.LOG).error(e).handle();
    }
  }
  // Re-create entity the duplicator
  entityDeDuplicator.clear();
  resultList.getResults().stream().map(Entity::getId).collect(Lambdas.into(entityDeDuplicator));
  start += resultList.size();
  return resultList.size() >= limit;
}
sirius.kernel.commonsLambdas

Javadoc

Helper class which provides various methods to work with lambdas.

Most used methods

  • into
    Used to collect the results of a stream operation into an existing collection.

Popular in Java

  • Reading from database using SQL prepared statement
  • getExternalFilesDir (Context)
  • orElseThrow (Optional)
  • getSystemService (Context)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • List (java.util)
    A List is a collection which maintains an ordering for its elements. Every element in the List has a
  • Stack (java.util)
    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with
  • Reference (javax.naming)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now