Class StructSome
java.lang.Object
ortus.boxlang.runtime.bifs.BIF
ortus.boxlang.runtime.bifs.global.struct.StructSome
- Direct Known Subclasses:
StructNone
@BoxBIF(description="Test whether at least one item in struct matches the callback function")
@BoxMember(type=STRUCT)
public class StructSome
extends BIF
-
Field Summary
Fields inherited from class ortus.boxlang.runtime.bifs.BIF
__functionName, __isMemberExecution, asyncService, cacheService, componentService, declaredArguments, functionService, interceptorService, logger, moduleService, runtime, schedulerService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription_invoke(IBoxContext context, ArgumentsScope arguments) Used to iterate over a struct and test whether ANY items meet the test callback.Methods inherited from class ortus.boxlang.runtime.bifs.BIF
announce, getDeclaredArguments, invoke
-
Constructor Details
-
StructSome
public StructSome()Constructor
-
-
Method Details
-
_invoke
Used to iterate over a struct and test whether ANY items meet the test callback. The function will be passed 3 arguments: the key, the value, and the struct. You can alternatively pass a Java BiPredicate which will only receive the first 2 args. The function should return true if the item meets the test, and false otherwise.Note: This operation is a short-circuit operation, meaning it will stop iterating as soon as it finds the first item that meets the test condition.
Parallel Execution
If theparallelargument is set to true, and nomax_threadsare sent, the filter will be executed in parallel using a ForkJoinPool with parallel streams. Ifmax_threadsis specified, it will create a new ForkJoinPool with the specified number of threads to run the filter in parallel, and destroy it after the operation is complete. Please note that this may not be the most efficient way to iterate, as it will create a new ForkJoinPool for each invocation of the BIF. You may want to consider using a shared ForkJoinPool for better performance.
-