How can I pass a generic java function as a parameter?
Regarding passing the Java function as parameter, your test function is wrong in multiple places: boolean test(function someSortFunction){//This is not how you pass functions int n; //this has to be initialised for (int i=0; i int[] A = generateArray()//Missing semicolon if (isSorted(someSortFunction(A)) = false)…
Answered Oct 11, 2022 · 1.3K Views Read answer →