Package io.jawk.ext

Interface ForInKeyOrder

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ForInKeyOrder
Supplies the key traversal order used by for (index in array) statements.

The interpreter itself has no opinion about iteration order: it snapshots whatever collection this hook returns. Extensions that implement ordered traversal (such as the gawk compatibility extension honoring PROCINFO["sorted_in"]) register an instance from their beforeStart hook. Implementations that have no ordering to apply should return array.keySet() directly to avoid any extra copy.

  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the keys of array in the order for (index in array) should traverse them.
  • Method Details

    • order

      Collection<Object> order(Map<Object,Object> array)
      Returns the keys of array in the order for (index in array) should traverse them.
      Parameters:
      array - associative array about to be iterated
      Returns:
      the keys in traversal order; the interpreter copies the returned collection before iterating