About 6,090,000 results
Open links in new tab
  1. How to pass a function as a parameter in Java? [duplicate]

    Mar 8, 2023 · 22 Thanks to Java 8 you don't need to do the steps below to pass a function to a method, that's what lambdas are for, see Oracle's Lambda Expression tutorial. The rest of this …

  2. What does the arrow operator, '->', do in Java? - Stack Overflow

    7 New Operator for lambda expression added in java 8 Lambda expression is the short way of method writing. It is indirectly used to implement functional interface Primary Syntax : …

  3. Function within a function in Java - Stack Overflow

    Jan 13, 2017 · Is it possible to define a function within a function in Java? I am trying to do something like: public static boolean fun1() { static void fun2() { body of function. } fun(); return

  4. How do I use optional parameters in Java? - Stack Overflow

    Update: Java 8 includes the class java.util.Optional out-of-the-box, so there is no need to use guava for this particular reason in Java 8. The method name is a bit different though.

  5. Does Java support default parameter values? - Stack Overflow

    No, the structure you found is how Java handles it, (that is, with overloading instead of default parameters). For constructors, See Effective Java: Programming Language Guide's Item 1 tip …

  6. Is Java "pass-by-reference" or "pass-by-value"? - Stack Overflow

    Sep 3, 2008 · 871 Java is always pass by value, with no exceptions, ever. So how is it that anyone can be at all confused by this, and believe that Java is pass by reference, or think they …

  7. How can I write an anonymous function in Java? - Stack Overflow

    May 2, 2010 · 2 Yes, if you are using Java 8 or above. Java 8 make it possible to define anonymous functions, which was impossible in previous versions. Lets take example from java …

  8. How to asynchronously call a method in Java - Stack Overflow

    If you are using Java 5 or later, FutureTask is a turnkey implementation of "A cancellable asynchronous computation." There are even richer asynchronous execution scheduling …

  9. Calling Java from Python - Stack Overflow

    My solution to my problem was by running this java code as BeanShell scripts by calling the BeanShell interpreter as a shell command from within my python code after editing the java …

  10. Help with understanding a function object or functor in Java

    Sep 10, 2011 · For example, the interface Comparator in Mohammad Faisal's answer. Providing a more general approach, and one that takes syntax, is a major goal for Java 8 (The next …