I want to get an element (NOT the index) from a Java list using a callback.
In JavaScript, there is the Array.prototype.find method that does exactly that.
For example:
let match = [1, 2, 3, 4, 5].find((num) => num === 3);
console.log(match); // 3
Is there a Java equivalent?