當前位置: 首頁>>代碼示例>>Java>>正文


Java ToLongFunction.applyAsLong方法代碼示例

本文整理匯總了Java中java.util.function.ToLongFunction.applyAsLong方法的典型用法代碼示例。如果您正苦於以下問題:Java ToLongFunction.applyAsLong方法的具體用法?Java ToLongFunction.applyAsLong怎麽用?Java ToLongFunction.applyAsLong使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.function.ToLongFunction的用法示例。


在下文中一共展示了ToLongFunction.applyAsLong方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: toLong

import java.util.function.ToLongFunction; //導入方法依賴的package包/類
/**
 * Creates an LONG mapper that wraps to function provided
 * @param function  the function to wrap
 * @param <I>       the input type
 * @return          the newly created mapper
 */
public static <I,O> Function1<I,Long> toLong(ToLongFunction<I> function) {
    return new Function1<I,Long>(FunctionStyle.LONG) {
        @Override
        public final long applyAsLong(I value) {
            return function.applyAsLong(value);
        }
    };
}
 
開發者ID:zavtech,項目名稱:morpheus-core,代碼行數:15,代碼來源:Function1.java

示例2: DefaultCardinalityEstimator

import java.util.function.ToLongFunction; //導入方法依賴的package包/類
public DefaultCardinalityEstimator(double certaintyProb,
                                   int numInputs,
                                   boolean isAllowMoreInputs,
                                   ToLongFunction<long[]> singlePointEstimator) {
    this(certaintyProb,
            numInputs,
            isAllowMoreInputs,
            (inputCards, rheemContext) -> singlePointEstimator.applyAsLong(inputCards));
}
 
開發者ID:daqcri,項目名稱:rheem,代碼行數:10,代碼來源:DefaultCardinalityEstimator.java

示例3: lop

import java.util.function.ToLongFunction; //導入方法依賴的package包/類
private static long lop(Row row, String name, ToLongFunction<Row> f) {
    if (row.getColumnDefinitions().contains(name)) {
        return f.applyAsLong(row);
    } else {
        return 0;
    }
}
 
開發者ID:dmart28,項目名稱:gcplot,代碼行數:8,代碼來源:Mapper.java

示例4: summingLong

import java.util.function.ToLongFunction; //導入方法依賴的package包/類
/**
 * Returns a {@code Collector} that produces the sum of a long-valued
 * function applied to the input elements.  If no elements are present,
 * the result is 0.
 *
 * @param <T> the type of the input elements
 * @param mapper a function extracting the property to be summed
 * @return a {@code Collector} that produces the sum of a derived property
 */
public static <T> Collector<T, ?, Long>
summingLong(ToLongFunction<? super T> mapper) {
    return new CollectorImpl<>(
            () -> new long[1],
            (a, t) -> { a[0] += mapper.applyAsLong(t); },
            (a, b) -> { a[0] += b[0]; return a; },
            a -> a[0], CH_NOID);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:18,代碼來源:Collectors.java

示例5: averagingLong

import java.util.function.ToLongFunction; //導入方法依賴的package包/類
/**
 * Returns a {@code Collector} that produces the arithmetic mean of a long-valued
 * function applied to the input elements.  If no elements are present,
 * the result is 0.
 *
 * @param <T> the type of the input elements
 * @param mapper a function extracting the property to be summed
 * @return a {@code Collector} that produces the sum of a derived property
 */
public static <T> Collector<T, ?, Double>
averagingLong(ToLongFunction<? super T> mapper) {
    return new CollectorImpl<>(
            () -> new long[2],
            (a, t) -> { a[0] += mapper.applyAsLong(t); a[1]++; },
            (a, b) -> { a[0] += b[0]; a[1] += b[1]; return a; },
            a -> (a[1] == 0) ? 0.0d : (double) a[0] / a[1], CH_NOID);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:18,代碼來源:Collectors.java

示例6: averagingLong

import java.util.function.ToLongFunction; //導入方法依賴的package包/類
/**
 * Returns a {@code Collector} that produces the arithmetic mean of a long-valued
 * function applied to the input elements.  If no elements are present,
 * the result is 0.
 *
 * @param <T> the type of the input elements
 * @param mapper a function extracting the property to be averaged
 * @return a {@code Collector} that produces the arithmetic mean of a
 * derived property
 */
public static <T> Collector<T, ?, Double>
averagingLong(ToLongFunction<? super T> mapper) {
    return new CollectorImpl<>(
            () -> new long[2],
            (a, t) -> { a[0] += mapper.applyAsLong(t); a[1]++; },
            (a, b) -> { a[0] += b[0]; a[1] += b[1]; return a; },
            a -> (a[1] == 0) ? 0.0d : (double) a[0] / a[1], CH_NOID);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:19,代碼來源:Collectors.java


注:本文中的java.util.function.ToLongFunction.applyAsLong方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。