Java 类java.util.function.LongPredicate 实例源码

项目:CodeKatas    文件:PrimitiveFunctionalInterfaceTest.java   
@Test
public void LongPredicate()
{
    // TODO - Convert the anonymous inner class to a lambda
    LongPredicate predicate = new LongPredicate()
    {
        @Override
        public boolean test(long value)
        {
            return value % 2 == 0;
        }
    };
    List<Long> evens =
            LongStream.rangeClosed(1, 5).filter(predicate).boxed().collect(Collectors.toList());
    Assert.assertEquals(Arrays.asList(2L, 4L), evens);
    List<Long> odds =
            LongStream.rangeClosed(1, 5).filter(predicate.negate()).boxed().collect(Collectors.toList());
    Assert.assertEquals(Arrays.asList(1L, 3L, 5L), odds);
    Assert.assertTrue(LongStream.rangeClosed(1, 5).anyMatch(predicate));
    Assert.assertFalse(LongStream.rangeClosed(1, 5).allMatch(predicate));
    Assert.assertFalse(LongStream.rangeClosed(1, 5).noneMatch(predicate));
}
项目:OpenJSharp    文件:LongPipeline.java   
@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);
                }
            };
        }
    };
}
项目:OpenJSharp    文件:MatchOps.java   
/**
 * 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);
}
项目:jdk8u-jdk    文件:LongPipeline.java   
@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);
                }
            };
        }
    };
}
项目:jdk8u-jdk    文件:MatchOps.java   
/**
 * 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);
}
项目:openjdk-jdk10    文件:LongPipeline.java   
@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);
                }
            };
        }
    };
}
项目:openjdk-jdk10    文件:MatchOps.java   
/**
 * 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);
}
项目:openjdk9    文件:LongPipeline.java   
@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);
                }
            };
        }
    };
}
项目:openjdk9    文件:MatchOps.java   
/**
 * 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);
}
项目:Java8CN    文件:LongPipeline.java   
@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);
                }
            };
        }
    };
}
项目:Java8CN    文件:MatchOps.java   
/**
 * 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);
}
项目:jdk8u_jdk    文件:MatchOps.java   
/**
 * 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);
}
项目:lookaside_java-1.8.0-openjdk    文件:LongPipeline.java   
@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);
                }
            };
        }
    };
}
项目:lookaside_java-1.8.0-openjdk    文件:MatchOps.java   
/**
 * 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);
}
项目:memoization.java    文件:ConcurrentMapBasedLongPredicateMemoizerTest.java   
/**
*
*/
@Test
@SuppressWarnings(CompilerWarnings.UNUSED)
public void shouldRequireNonNullCache() {
    // given
    final ConcurrentMap<Long, Boolean> cache = null;
    final LongPredicate predicate = input -> true;
    final LongFunction<Long> keyFunction = Long::valueOf;

    // when
    thrown.expect(NullPointerException.class);
    thrown.expectMessage("Provide an empty map instead of NULL.");

    // then
    new ConcurrentMapBasedLongPredicateMemoizer<>(cache, keyFunction, predicate);
}
项目:memoization.java    文件:GuavaCacheBasedLongPredicateMemoizerTest.java   
/**
*
*/
@Test
public void shouldTestGivenValue() {
    // given
    final LongPredicate predicate = Mockito.mock(LongPredicate.class);
    final LongFunction<String> keyFunction = a -> "key";
    final Cache<String, Boolean> cache = CacheBuilder.newBuilder().build();

    // when
    final GuavaCacheBasedLongPredicateMemoizer<String> memoizer = new GuavaCacheBasedLongPredicateMemoizer<>(
            cache, keyFunction, predicate);

    // then
    memoizer.test(123);
    Mockito.verify(predicate).test(123);
}
项目:memoization.java    文件:GuavaCacheBasedLongPredicateMemoizerTest.java   
/**
 * @throws ExecutionException
 *             Added for the call to 'cache.get(..)'.
 */
@Test
@SuppressWarnings(CompilerWarnings.UNCHECKED)
public void shouldWrapExecutionExceptionInMemoizationException() throws ExecutionException {
    // given
    final LongPredicate predicate = a -> true;
    final LongFunction<String> keyFunction = a -> "key";
    final Cache<String, Boolean> cache = Mockito.mock(Cache.class);
    given(cache.get(any(), any())).willThrow(ExecutionException.class);
    final GuavaCacheBasedLongPredicateMemoizer<String> memoizer = new GuavaCacheBasedLongPredicateMemoizer<>(
            cache, keyFunction, predicate);

    // when
    thrown.expect(MemoizationException.class);

    // then
    memoizer.test(123);
}
项目:jdk8u-jdk    文件:MatchOpTest.java   
private void assertLongPredicates(Supplier<LongStream> source, Kind kind, LongPredicate[] predicates, boolean... answers) {
    for (int i = 0; i < predicates.length; i++) {
        setContext("i", i);
        boolean match = longKinds.get(kind).apply(predicates[i]).apply(source.get());
        assertEquals(answers[i], match, kind.toString() + predicates[i].toString());
    }
}
项目:jdk8u-jdk    文件:MatchOpTest.java   
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongStream(String name, TestData.OfLong data) {
    for (LongPredicate p : LONG_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpFalse), longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpEven), longKinds.get(kind).apply(p));
        }
    }
}
项目:openjdk-jdk10    文件:MatchOpTest.java   
private void assertLongPredicates(Supplier<LongStream> source, Kind kind, LongPredicate[] predicates, boolean... answers) {
    for (int i = 0; i < predicates.length; i++) {
        setContext("i", i);
        boolean match = longKinds.get(kind).apply(predicates[i]).apply(source.get());
        assertEquals(answers[i], match, kind.toString() + predicates[i].toString());
    }
}
项目:openjdk-jdk10    文件:MatchOpTest.java   
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongStream(String name, TestData.OfLong data) {
    for (LongPredicate p : LONG_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpFalse), longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpEven), longKinds.get(kind).apply(p));
        }
    }
}
项目:test-as-you-think    文件:ResultOfEventTest.java   
@Test
public void should_verify_an_actual_long_predicate_is_conform_to_an_expected_result() {
    assertThat(resultOf(() -> {
        gwtMock.whenAnEventHappensInRelationToAnActionOfTheConsumer();
        return (LongPredicate) number -> number < 100;
    }).accepts(99)).hasSameClassAs(assertThat((LongPredicate) t -> t == 0));
}
项目:morpheus-core    文件:RangeOfLongs.java   
/**
 * Constructor
 * @param start     the start for range, inclusive
 * @param end       the end for range, exclusive
 * @param step      the step increment
 * @param excludes  optional predicate to exclude elements in this range
 */
RangeOfLongs(long start, long end, long step, LongPredicate excludes) {
    super(start, end);
    this.start = start;
    this.end = end;
    this.step = step;
    this.ascend = start <= end;
    this.excludes = excludes;
}
项目:throwable-interfaces    文件:LongPredicateWithThrowable.java   
/**
 * @param defaultReturnValue A value to return if any throwable is caught.
 * @return An interface that returns a default value if any exception occurs.
 */
default LongPredicate thatReturnsOnCatch(final boolean defaultReturnValue) {
  return (final long v1) -> {
    try {
      return testWithThrowable(v1);
    } catch(final Throwable throwable) {
      return defaultReturnValue;
    }
  };
}
项目:memoization.java    文件:JCacheMemoizeCustomKeyTest.java   
/**
*
*/
@Test
public void shouldMemoizeLongPredicateWithKeyFunction() {
    // given
    final LongPredicate predicate = a -> true;
    final LongFunction<String> keyFunction = a -> "key";

    // when
    final LongPredicate memoize = JCacheMemoize.longPredicate(predicate, keyFunction);

    // then
    Assert.assertNotNull("Memoized LongPredicate is NULL", memoize);
}
项目:memoization.java    文件:ConcurrentMapBasedLongPredicateMemoizerTest.java   
/**
*
*/
@Test
public void shouldMemoizePredicateCall() {
    // given
    final ConcurrentMap<Long, Boolean> cache = new ConcurrentHashMap<>();
    final LongPredicate predicate = input -> true;
    final LongFunction<Long> keyFunction = Long::valueOf;

    // when
    final ConcurrentMapBasedLongPredicateMemoizer<Long> memoizer = new ConcurrentMapBasedLongPredicateMemoizer<>(
            cache, keyFunction, predicate);

    // then
    Assert.assertTrue("Memoized value does not match expectations", memoizer.test(123L));
}
项目:memoization.java    文件:JCacheMemoizeLambdaTest.java   
/**
*
*/
@Test
public void shouldMemoizeLongPredicateWithLambda() {
    // given

    // when
    final LongPredicate memoize = JCacheMemoize.longPredicate(a -> true);

    // then
    Assert.assertNotNull("Memoized LongPredicate is NULL", memoize);
}
项目:memoization.java    文件:ConcurrentMapBasedLongPredicateMemoizer.java   
@SuppressWarnings(CompilerWarnings.NLS)
ConcurrentMapBasedLongPredicateMemoizer(
        final ConcurrentMap<KEY, Boolean> cache,
        final LongFunction<KEY> keyFunction,
        final LongPredicate predicate) {
    super(cache);
    this.keyFunction = keyFunction;
    this.predicate = requireNonNull(predicate,
            "Cannot memoize a NULL Predicate - provide an actual Predicate to fix this.");
}
项目:openjdk9    文件:MatchOpTest.java   
private void assertLongPredicates(Supplier<LongStream> source, Kind kind, LongPredicate[] predicates, boolean... answers) {
    for (int i = 0; i < predicates.length; i++) {
        setContext("i", i);
        boolean match = longKinds.get(kind).apply(predicates[i]).apply(source.get());
        assertEquals(answers[i], match, kind.toString() + predicates[i].toString());
    }
}
项目:openjdk9    文件:MatchOpTest.java   
@Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
public void testLongStream(String name, TestData.OfLong data) {
    for (LongPredicate p : LONG_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpFalse), longKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(lpEven), longKinds.get(kind).apply(p));
        }
    }
}
项目:parallel-stream-support    文件:ParallelLongStreamSupportTest.java   
@Test
public void noneMatch() {
  LongPredicate p = i -> true;

  boolean result = this.parallelStreamSupportMock.noneMatch(p);

  verify(this.delegateMock).noneMatch(p);
  assertTrue(result);
}
项目:memoization.java    文件:JCacheMemoizeDefaultsTest.java   
/**
*
*/
@Test
public void shouldMemoizeLongPredicate() {
    // given
    final LongPredicate predicate = a -> true;

    // when
    final LongPredicate memoize = JCacheMemoize.longPredicate(predicate);

    // then
    Assert.assertNotNull("Memoized LongPredicate is NULL", memoize);
}
项目:validity    文件:ValidityUtilsTest.java   
@Test
void testDescribeLongPredicateReturnsExpectedStringForNonDescriptive() {
    LongPredicate predicate = t -> t > 0;
    Assertions.assertEquals(ValidityUtils.unknownPredicatePrefix() + predicate.toString(),
                            ValidityUtils.describe(predicate),
                            "Non descriptive predicate should be consistently described.");
}
项目:validity    文件:DescriptiveLongPredicateTest.java   
@Test
void testDescriptiveLongPredicateHasExpectedPredicate() {
    LongPredicate predicate = getNotValueTypeInstance();
    Assertions.assertAll("DescriptiveLongPredicate should wrap the expected predicate.",
                         () -> Assertions.assertTrue(predicate.test(1)),
                         () -> Assertions.assertFalse(predicate.test(0)),
                         () -> Assertions.assertFalse(predicate.test(-1)));
}
项目:validity    文件:DescriptiveLongPredicateTest.java   
@Test
void testDescriptiveLongPredicateAndHasExpectedPredicate() {
    LongPredicate other = new DescriptiveLongPredicate("10 > " + AbstractDescriptivePredicate.TOKEN, t -> 10 > t);
    LongPredicate predicate = getNotValueTypeInstance().and(other);
    Assertions.assertAll("DescriptiveLongPredicate should wrap the expected predicate.",
                         () -> Assertions.assertFalse(predicate.test(-1)),
                         () -> Assertions.assertFalse(predicate.test(0)),
                         () -> Assertions.assertTrue(predicate.test(1)),
                         () -> Assertions.assertTrue(predicate.test(9)),
                         () -> Assertions.assertFalse(predicate.test(10)));
}
项目:validity    文件:DescriptiveLongPredicateTest.java   
@Test
void testDescriptiveLongPredicateOrHasExpectedPredicate() {
    LongPredicate other = new DescriptiveLongPredicate("10 > " + AbstractDescriptivePredicate.TOKEN, t -> 10 > t);
    LongPredicate predicate = getNotValueTypeInstance().or(other);
    Assertions.assertAll("DescriptiveLongPredicate should wrap the expected predicate.",
                         () -> Assertions.assertTrue(predicate.test(-1)),
                         () -> Assertions.assertTrue(predicate.test(0)),
                         () -> Assertions.assertTrue(predicate.test(1)),
                         () -> Assertions.assertTrue(predicate.test(9)),
                         () -> Assertions.assertTrue(predicate.test(10)));
}
项目:memoization.java    文件:ConcurrentMapBasedLongPredicateMemoizerTest.java   
/**
*
*/
@Test
public void shouldAcceptCacheAndPredicate() {
    // given
    final ConcurrentMap<Long, Boolean> cache = new ConcurrentHashMap<>();
    final LongPredicate predicate = input -> true;
    final LongFunction<Long> keyFunction = Long::valueOf;

    // when
    final ConcurrentMapBasedLongPredicateMemoizer<Long> memoizer = new ConcurrentMapBasedLongPredicateMemoizer<>(
            cache, keyFunction, predicate);

    // then
    Assert.assertNotNull("Memoizer is NULL", memoizer);
}
项目:memoization.java    文件:MapMemoizeLambdaTest.java   
/**
*
*/
@Test
public void shouldMemoizeLongPredicateWithLambda() {
    // given

    // when
    final LongPredicate memoize = MapMemoize.longPredicate(input -> true);

    // then
    Assert.assertNotNull("Memoized LongPredicate is NULL", memoize);
}
项目:throwable-interfaces    文件:LongPredicateWithThrowable.java   
/**
 * @throws E if an exception E has been thrown, it is rethrown by this method
 * @return An interface that is only returned if no exception has been thrown.
 */
default LongPredicate thatUnsafelyThrowsUnchecked() throws E {
  return (final long v1) -> {
    try {
      return testWithThrowable(v1);
    } catch(final Throwable throwable) {
       SuppressedException.throwUnsafelyAsUnchecked(throwable);
       return false;        }
  };
}
项目:memoization.java    文件:MapMemoizeDefaultsTest.java   
/**
*
*/
@Test
public void shouldMemoizeLongPredicate() {
    // given
    final LongPredicate predicate = input -> true;

    // when
    final LongPredicate memoize = MapMemoize.longPredicate(predicate);

    // then
    Assert.assertNotNull("Memoized LongPredicate is NULL", memoize);
}