当前位置: 首页>>代码示例>>Java>>正文


Java LongPredicate.test方法代码示例

本文整理汇总了Java中java.util.function.LongPredicate.test方法的典型用法代码示例。如果您正苦于以下问题:Java LongPredicate.test方法的具体用法?Java LongPredicate.test怎么用?Java LongPredicate.test使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.function.LongPredicate的用法示例。


在下文中一共展示了LongPredicate.test方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: filter

import java.util.function.LongPredicate; //导入方法依赖的package包/类
@Override
public final LongStream filter(LongPredicate predicate) {
    Objects.requireNonNull(predicate);
    return new StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                 StreamOpFlag.NOT_SIZED) {
        @Override
        Sink<Long> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedLong<Long>(sink) {
                @Override
                public void begin(long size) {
                    downstream.begin(-1);
                }

                @Override
                public void accept(long t) {
                    if (predicate.test(t))
                        downstream.accept(t);
                }
            };
        }
    };
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:LongPipeline.java

示例2: makeLong

import java.util.function.LongPredicate; //导入方法依赖的package包/类
/**
 * Constructs a quantified predicate matcher for a {@code LongStream}.
 *
 * @param predicate the {@code Predicate} to apply to stream elements
 * @param matchKind the kind of quantified match (all, any, none)
 * @return a {@code TerminalOp} implementing the desired quantified match
 *         criteria
 */
public static TerminalOp<Long, Boolean> makeLong(LongPredicate predicate,
                                                 MatchKind matchKind) {
    Objects.requireNonNull(predicate);
    Objects.requireNonNull(matchKind);
    class MatchSink extends BooleanTerminalSink<Long> implements Sink.OfLong {

        MatchSink() {
            super(matchKind);
        }

        @Override
        public void accept(long t) {
            if (!stop && predicate.test(t) == matchKind.stopOnPredicateMatches) {
                stop = true;
                value = matchKind.shortCircuitResult;
            }
        }
    }

    return new MatchOp<>(StreamShape.LONG_VALUE, matchKind, MatchSink::new);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:MatchOps.java

示例3: allMatch

import java.util.function.LongPredicate; //导入方法依赖的package包/类
@Override
default boolean allMatch(@NonNull final LongPredicate predicate) {
  return predicate.test(this.x()) && predicate.test(this.y());
}
 
开发者ID:KyoriPowered,项目名称:math,代码行数:5,代码来源:Vector2l.java

示例4: anyMatch

import java.util.function.LongPredicate; //导入方法依赖的package包/类
@Override
default boolean anyMatch(@NonNull final LongPredicate predicate) {
  return predicate.test(this.x()) || predicate.test(this.y());
}
 
开发者ID:KyoriPowered,项目名称:math,代码行数:5,代码来源:Vector2l.java

示例5: allMatch

import java.util.function.LongPredicate; //导入方法依赖的package包/类
@Override
default boolean allMatch(@NonNull final LongPredicate predicate) {
  return predicate.test(this.x()) && predicate.test(this.y()) && predicate.test(this.z()) && predicate.test(this.w());
}
 
开发者ID:KyoriPowered,项目名称:math,代码行数:5,代码来源:Vector4l.java

示例6: anyMatch

import java.util.function.LongPredicate; //导入方法依赖的package包/类
@Override
default boolean anyMatch(@NonNull final LongPredicate predicate) {
  return predicate.test(this.x()) || predicate.test(this.y()) || predicate.test(this.z()) || predicate.test(this.w());
}
 
开发者ID:KyoriPowered,项目名称:math,代码行数:5,代码来源:Vector4l.java

示例7: allMatch

import java.util.function.LongPredicate; //导入方法依赖的package包/类
@Override
default boolean allMatch(@NonNull final LongPredicate predicate) {
  return predicate.test(this.x()) && predicate.test(this.y()) && predicate.test(this.z());
}
 
开发者ID:KyoriPowered,项目名称:math,代码行数:5,代码来源:Vector3l.java

示例8: anyMatch

import java.util.function.LongPredicate; //导入方法依赖的package包/类
@Override
default boolean anyMatch(@NonNull final LongPredicate predicate) {
  return predicate.test(this.x()) || predicate.test(this.y()) || predicate.test(this.z());
}
 
开发者ID:KyoriPowered,项目名称:math,代码行数:5,代码来源:Vector3l.java

示例9: satisfies

import java.util.function.LongPredicate; //导入方法依赖的package包/类
/**
 * Tests the subject with the given predicate. Note that any {@link Throwable} thrown
 * during the testing of the predicate is not handled and will be thrown instead
 * of the usual throwable for this verifiable instance.
 *
 * @param expected the {@link LongPredicate} to use to test the subject.
 *                 May not be null.
 * @return the subject if it satisfies the predicate.
 * @throws X                    if the subject does not satisfy the predicate.
 * @throws NullPointerException if expected is null.
 */
public long satisfies(LongPredicate expected) throws X {
    if (null == expected) {
        throw new NullPointerException(ValidityUtils.nullArgumentMessage("expected"));
    }
    if (!expected.test(subject)) {
        fail(ValidityUtils.describe(expected));
    }
    return subject;
}
 
开发者ID:redfin,项目名称:validity,代码行数:21,代码来源:VerifiablePrimitiveLong.java


注:本文中的java.util.function.LongPredicate.test方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。