org.jooq.lambda.Unchecked.biConsumer()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(160)

本文整理了Java中org.jooq.lambda.Unchecked.biConsumer()方法的一些代码示例,展示了Unchecked.biConsumer()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Unchecked.biConsumer()方法的具体详情如下:
包路径:org.jooq.lambda.Unchecked
类名称:Unchecked
方法名:biConsumer

Unchecked.biConsumer介绍

[英]Wrap a org.jooq.lambda.fi.util.function.CheckedBiConsumer in a BiConsumer.

Example: ``

map.forEach(Unchecked.biConsumer((k, v) -> { 
if (k == null || v == null) 
throw new Exception("No nulls allowed in map"); 
}));

[中]包装一个组织。约克。拉姆达。菲。util。作用在双消费者中选中双消费者。
示例:``

map.forEach(Unchecked.biConsumer((k, v) -> { 
if (k == null || v == null) 
throw new Exception("No nulls allowed in map"); 
}));

代码示例

代码示例来源:origin: org.jooq/jool

/**
   * @see {@link Unchecked#biConsumer(CheckedBiConsumer, Consumer)}
   */
  static <T, U> BiConsumer<T, U> unchecked(CheckedBiConsumer<T, U> consumer, Consumer<Throwable> handler) {
    return Unchecked.biConsumer(consumer, handler);
  }
}

代码示例来源:origin: org.jooq/jool-java-8

/**
   * @see {@link Unchecked#biConsumer(CheckedBiConsumer, Consumer)}
   */
  static <T, U> BiConsumer<T, U> unchecked(CheckedBiConsumer<T, U> consumer, Consumer<Throwable> handler) {
    return Unchecked.biConsumer(consumer, handler);
  }
}

代码示例来源:origin: org.jooq/jool

/**
 * @see {@link Unchecked#biConsumer(CheckedBiConsumer)}
 */
static <T, U> BiConsumer<T, U> unchecked(CheckedBiConsumer<T, U> consumer) {
  return Unchecked.biConsumer(consumer);
}

代码示例来源:origin: org.jooq/jool-java-8

/**
 * @see {@link Unchecked#biConsumer(CheckedBiConsumer)}
 */
static <T, U> BiConsumer<T, U> unchecked(CheckedBiConsumer<T, U> consumer) {
  return Unchecked.biConsumer(consumer);
}

代码示例来源:origin: org.jooq/jool

/**
 * Wrap a {@link org.jooq.lambda.fi.util.function.CheckedBiConsumer} in a {@link BiConsumer}.
 * <p>
 * Example:
 * <code><pre>
 * map.forEach(Unchecked.biConsumer((k, v) -> {
 *     if (k == null || v == null)
 *         throw new Exception("No nulls allowed in map");
 * }));
 * </pre></code>
 */
public static <T, U> BiConsumer<T, U> biConsumer(CheckedBiConsumer<T, U> consumer) {
  return biConsumer(consumer, THROWABLE_TO_RUNTIME_EXCEPTION);
}

代码示例来源:origin: org.jooq/jool

/**
 * Wrap a {@link org.jooq.lambda.fi.util.function.CheckedBiConsumer} in a {@link BiConsumer}.
 * <p>
 * Example:
 * <code><pre>
 * map.forEach(Unchecked.biConsumer((k, v) -> {
 *     if (k == null || v == null)
 *         throw new Exception("No nulls allowed in map");
 * }));
 * </pre></code>
 */
public static <T, U> BiConsumer<T, U> biConsumer(CheckedBiConsumer<T, U> consumer) {
  return Unchecked.biConsumer(consumer, Unchecked.RETHROW_ALL);
}

代码示例来源:origin: org.jooq/jool-java-8

/**
 * Wrap a {@link org.jooq.lambda.fi.util.function.CheckedBiConsumer} in a {@link BiConsumer}.
 * <p>
 * Example:
 * <code><pre>
 * map.forEach(Unchecked.biConsumer((k, v) -> {
 *     if (k == null || v == null)
 *         throw new Exception("No nulls allowed in map");
 * }));
 * </pre></code>
 */
public static <T, U> BiConsumer<T, U> biConsumer(CheckedBiConsumer<T, U> consumer) {
  return Unchecked.biConsumer(consumer, Unchecked.RETHROW_ALL);
}

代码示例来源:origin: org.jooq/jool-java-8

/**
 * Wrap a {@link org.jooq.lambda.fi.util.function.CheckedBiConsumer} in a {@link BiConsumer}.
 * <p>
 * Example:
 * <code><pre>
 * map.forEach(Unchecked.biConsumer((k, v) -> {
 *     if (k == null || v == null)
 *         throw new Exception("No nulls allowed in map");
 * }));
 * </pre></code>
 */
public static <T, U> BiConsumer<T, U> biConsumer(CheckedBiConsumer<T, U> consumer) {
  return biConsumer(consumer, THROWABLE_TO_RUNTIME_EXCEPTION);
}

代码示例来源:origin: RankSys/RankSys

/**
 * Saves a PreferenceData instance in two files for user and item preferences, respectively. The format of the user preferences stream consists on one list per line, starting with the identifier of the user followed by the identifier-rating pairs of the items related to that. The item preferences stream follows the same format by swapping the roles of users and items.
 *
 * @param prefData preferences
 * @param uo stream of user preferences
 * @param io stream of user preferences
 */
public void write(FastPreferenceData<?, ?> prefData, OutputStream uo, OutputStream io) {
  BiConsumer<FastPreferenceData<?, ?>, OutputStream> saver = Unchecked.biConsumer((prefs, os) -> {
    try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os))) {
      prefs.getUidxWithPreferences().forEach(Unchecked.intConsumer(uidx -> {
        String a = prefs.getUidxPreferences(uidx)
            .sorted((p1, p2) -> Integer.compare(p1.v1, p2.v1))
            .map(p -> p.v1 + "\t" + (int) p.v2)
            .collect(joining("\t"));
        writer.write(uidx + "\t" + a);
        writer.newLine();
      }));
    }
  });
  saver.accept(prefData, uo);
  saver.accept(new TransposedPreferenceData<>(prefData), io);
}

代码示例来源:origin: RankSys/RankSys

/**
 * Saves a PreferenceData instance in two files for user and item preferences, respectively. The format of the user preferences stream consists on one list per line, starting with the identifier of the user followed by the identifiers of the items related to that. The item preferences stream follows the same format by swapping the roles of users and items.
 *
 * @param prefData preferences
 * @param uo stream of user preferences
 * @param io stream of user preferences
 */
public void write(FastPreferenceData<?, ?> prefData, OutputStream uo, OutputStream io) {
  BiConsumer<FastPreferenceData<?, ?>, OutputStream> saver = Unchecked.biConsumer((prefs, os) -> {
    try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os))) {
      prefs.getUidxWithPreferences().forEach(Unchecked.intConsumer(uidx -> {
        String a = prefs.getUidxPreferences(uidx)
            .mapToInt(IdxPref::v1)
            .sorted()
            .mapToObj(Integer::toString)
            .collect(joining("\t"));
        writer.write(uidx + "\t" + a);
        writer.newLine();
      }));
    }
  });
  saver.accept(prefData, uo);
  saver.accept(new TransposedPreferenceData<>(prefData), io);
}

代码示例来源:origin: org.apereo.cas/cas-server-webapp-config

@Override
protected void configure(final HttpSecurity http) throws Exception {
  http.csrf().disable()
    .headers().disable()
    .logout()
    .disable()
    .requiresChannel()
    .requestMatchers(r -> r.getHeader("X-Forwarded-Proto") != null)
    .requiresSecure();
  val requests = http.authorizeRequests();
  configureEndpointAccessToDenyUndefined(http, requests);
  configureEndpointAccessForStaticResources(requests);
  val endpoints = casProperties.getMonitor().getEndpoints().getEndpoint();
  endpoints.forEach(Unchecked.biConsumer((k, v) -> {
    val endpoint = EndpointRequest.to(k);
    v.getAccess().forEach(Unchecked.consumer(access -> configureEndpointAccess(http, requests, access, v, endpoint)));
  }));
}

代码示例来源:origin: RankSys/RankSys

rerankersMap.forEach(Unchecked.biConsumer((name, rerankerSupplier) -> {
  System.out.println("Running " + name);
  String recOut = String.format("%s_%s", recIn, name);

代码示例来源:origin: RankSys/RankSys

RecommenderRunner<Long, Long> runner = new FastFilterRecommenderRunner<>(userIndex, itemIndex, targetUsers.stream(), filter, maxLength);
recMap.forEach(Unchecked.biConsumer((name, recommender) -> {
  System.out.println("Running " + name);
  try (RecommendationFormat.Writer<Long, Long> writer = format.getWriter(name)) {

相关文章