Software architecture
Cross-feature call count
Measure calls in a controlled example, not latency. Executed Java 21 fixture.
Formal Syntax & Structure
java syntaxjava
calls[0]++Working Example
Example Snippetjava
public class Main { interface Reserve { boolean reserve(int n); } static boolean place(Reserve stock,int n) { if (n <= 0) throw new IllegalArgumentException("quantity"); return stock.reserve(n); } public static void main(String[] args) { int[] calls = {0}; Reserve stock = n -> { calls[0]++; return n <= 3; }; System.out.println(place(stock,2)); System.out.println(calls[0]); }}