Class ArrayFind

java.lang.Object
ortus.boxlang.runtime.bifs.BIF
ortus.boxlang.runtime.bifs.global.array.ArrayFind
Direct Known Subclasses:
ListFind

@BoxBIF @BoxBIF(alias="ArrayFindNoCase") @BoxBIF(alias="ArrayContains") @BoxBIF(alias="ArrayContainsNoCase") @BoxMember(type=ARRAY) @BoxMember(type=ARRAY,name="findNoCase") @BoxMember(type=ARRAY,name="contains") @BoxMember(type=ARRAY,name="containsNoCase") public class ArrayFind extends BIF
  • Constructor Details

    • ArrayFind

      public ArrayFind()
      Constructor
  • Method Details

    • _invoke

      public Object _invoke(IBoxContext context, ArgumentsScope arguments)
      Array finders and contains functions with and without case sensitivity. Please note that "contain" methods return a boolean, while "find" methods return an index. If you use a function as the value, it will be used as a search closure or lambda. The signature of the function should be:
          ( value, index ) => {
                      return true; // if the value is found, else false
         }
       
      Example:
         array = [ 1, 2, 3, 4, 5 ];
        index = array.find( ( value, index ) -> {
                      return value == 3;
       } );
       
      We recommend you use BoxLang lambdas (->) for this purpose, so they only act upon the value and index without any side effects. They will be faster and more efficient.
      Specified by:
      _invoke in class BIF
      Parameters:
      context - The context in which the BIF is being invoked.
      arguments - Argument scope for the BIF.
      Returns:
      The result of the invocation