本文整理了Java中java.util.stream.IntStream.anyMatch()
方法的一些代码示例,展示了IntStream.anyMatch()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IntStream.anyMatch()
方法的具体详情如下:
包路径:java.util.stream.IntStream
类名称:IntStream
方法名:anyMatch
[英]Returns whether any elements of this stream match the provided predicate. May not evaluate the predicate on all elements if not necessary for determining the result. If the stream is empty then false is returned and the predicate is not evaluated.
This is a short-circuiting terminal operation.
[中]返回此流的任何元素是否与提供的谓词匹配。如果不需要确定结果,则不能对所有元素的谓词求值。如果流为空,则返回false,并且不计算谓词。
这是一个short-circuiting terminal operation。
代码示例来源:origin: stackoverflow.com
int streamMethod(final String data, final IntPredicate predicate) {
if (data.chars().anyMatch(predicate)) {
doThrow();
}
return data.length();
}
代码示例来源:origin: opentripplanner/OpenTripPlanner
public boolean matches (RaptorWorkerTimetable from, RaptorWorkerTimetable to) {
if (fromMode != null && !IntStream.of(fromMode).anyMatch(m -> m == from.mode))
return false;
if (toMode != null && !IntStream.of(toMode).anyMatch(m -> m == to.mode))
return false;
return true;
}
}
代码示例来源:origin: ivan-vasilev/neuralnetworks
@Override
public boolean hasNext()
{
return IntStream.range(0, tensor.dimensions.length).anyMatch(i -> currentPosition[i] < limits[1][i]);
}
代码示例来源:origin: linkedin/cruise-control
/**
* Check if set a contains any element in set b.
* @param a the first set.
* @param b the second set.
* @return true if a contains at least one of the element in b. false otherwise;
*/
public static boolean containsAny(Set<Integer> a, Set<Integer> b) {
return b.stream().mapToInt(i -> i).anyMatch(a::contains);
}
代码示例来源:origin: org.assertj/assertj-core
private boolean containsOneOrMoreWhitespaces(CharSequence actual) {
return actual.chars().anyMatch(Character::isWhitespace);
}
代码示例来源:origin: stackoverflow.com
// avoid this at all costs
int streamParallelMethod(final String data, IntPredicate predicate) {
if (data.chars().parallel().anyMatch(predicate)) {
doThrow();
}
return data.length();
}
代码示例来源:origin: speedment/speedment
@Override
public Boolean execute() {
try (final IntStream stream = buildPrevious()) {
return stream.anyMatch(predicate);
}
}
}
代码示例来源:origin: joel-costigliola/assertj-core
private boolean containsOneOrMoreWhitespaces(CharSequence actual) {
return actual.chars().anyMatch(Character::isWhitespace);
}
代码示例来源:origin: runelite/runelite
private boolean checkArea()
{
return client.getMapRegions() != null && Arrays.stream(client.getMapRegions())
.filter(x -> Arrays.stream(HERBIBOAR_REGIONS).anyMatch(y -> y == x))
.toArray().length > 0;
}
代码示例来源:origin: speedment/speedment
default boolean anyMatch(IntPipeline pipeline, IntPredicate predicate) {
requireNonNull(pipeline);
requireNonNull(predicate);
return optimize(pipeline).getAsIntStream().anyMatch(predicate);
}
代码示例来源:origin: speedment/speedment
@Override
public boolean anyMatch(IntPredicate predicate) {
return finallyClose(() -> stream().anyMatch(predicate));
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
* Method to update on-the-fly "Include All Rows" checkbox whether "Cumulative sum" or "Cumulative average" values are configured in the Aggregation table.
*
* @param aggregationTable the aggregation table to check the entries
* @param allRowsButton the checkbox to update
* @param forceUpdate if an update must be done
*/
void updateAllRowsCheckbox( TableView aggregationTable, Button allRowsButton, boolean forceUpdate ) {
boolean isCumulativeSelected = IntStream.range( 0, aggregationTable.nrNonEmpty() )
.map( row -> GroupByMeta.getType( aggregationTable.getNonEmpty( row ).getText( AGGREGATION_TABLE_TYPE_INDEX ) ) )
.anyMatch( pred -> pred == GroupByMeta.TYPE_GROUP_CUMULATIVE_SUM || pred == GroupByMeta.TYPE_GROUP_CUMULATIVE_AVERAGE );
allRowsButton.setEnabled( !isCumulativeSelected );
if ( isCumulativeSelected ) {
allRowsButton.setSelection( true );
if ( forceUpdate ) {
backupChanged = true;
}
}
}
}
代码示例来源:origin: stackoverflow.com
if (data.chars().anyMatch(predicate)) {
doThrow();
if (data.chars().parallel().anyMatch(predicate)) {
doThrow();
代码示例来源:origin: loklak/loklak_server
if (post.get("key-size", null) != null) {
int finalKeyLength = post.get("key-size", 0);
if (!IntStream.of(allowedKeySizesRSA).anyMatch(x -> x == finalKeyLength)) {
throw new APIException(400, "Invalid key size.");
keySize = 8192;
if (!IntStream.of(allowedKeySizesRSA).anyMatch(x -> x == keySize)) {
throw new APIException(400, "Invalid key length.");
代码示例来源:origin: konsoletyper/teavm
private boolean findCondition() {
IntSet tailNodes = new IntHashSet(program.basicBlockCount());
for (int tailCandidate : cfg.incomingEdges(head)) {
if (nodes.contains(tailCandidate)) {
tailNodes.add(tailCandidate);
}
}
bodyStart = dom.commonDominatorOf(tailNodes.toArray());
int candidate = bodyStart;
while (bodyStart != head) {
int currentCandidate = candidate;
if (Arrays.stream(exits.toArray()).anyMatch(exit -> dom.dominates(currentCandidate, exit))) {
break;
}
bodyStart = candidate;
candidate = dom.immediateDominatorOf(candidate);
}
return candidate != bodyStart;
}
代码示例来源:origin: runelite/runelite
if (spriteIDs.anyMatch(id ->
id == SpriteID.SKILL_ATTACK || id == SpriteID.SKILL_STRENGTH || id == SpriteID.SKILL_DEFENCE
|| correctPrayer))
if (spriteIDs.anyMatch(id -> id == SpriteID.SKILL_RANGED || correctPrayer))
if (spriteIDs.anyMatch(id -> id == SpriteID.SKILL_MAGIC || correctPrayer))
代码示例来源:origin: stackoverflow.com
int[] array = {3, 2, 5, 4};
if (Arrays.stream(array).anyMatch(x -> x == 3)) {
System.out.println("The array contains 3");
}
代码示例来源:origin: stackoverflow.com
public static boolean containsHanScript(String s) {
return s.codePoints().anyMatch(
codepoint ->
Character.UnicodeScript.of(codepoint) == Character.UnicodeScript.HAN);
}
代码示例来源:origin: stackoverflow.com
public static int[] intersection(int[] a, int[] b) {
return Arrays.stream(a)
.filter(x -> Arrays.stream(b)
.anyMatch(y -> y == x)
)
.toArray();
}
代码示例来源:origin: BashSupport/BashSupport
@Override
boolean argumentValueExpected(String name) {
return name.chars().anyMatch(value -> Arrays.stream(VALUE_ARGS).anyMatch(c -> value == c));
}
}
内容来源于网络,如有侵权,请联系作者删除!