About 193,000 results
Open links in new tab
  1. How do I define a method which takes a lambda as a parameter in …

    Nov 28, 2012 · In Java 8, methods can be created as Lambda expressions and can be passed by reference (with a little work under the hood). There are plenty of examples online with lambdas …

  2. How to create a generic method in Java? - Stack Overflow

    Sep 18, 2013 · I'd like to make it a general use method so that I don't need to write new code for every new custom type. I could do this, which would require instantiating the object before …

  3. java - How can I generate Javadoc comments in Eclipse? - Stack …

    Nov 22, 2009 · Is there a way to generate Javadoc comments in Eclipse? If so, what is it?

  4. Can I add a function to enums in Java? - Stack Overflow

    As well as using the techniques above which add a field to the enumerated type you can also use a pure method based approach and polymorphism. This is more "OOP style" but I would not …

  5. java - When is it OK to create object of a class inside a method of ...

    Oct 24, 2012 · Is it not strange to create a object in the definition of same class? Because then in response - this object creates a new object, then this new object creates another, and the …

  6. How to pass a function as a parameter in Java? [duplicate]

    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 post describes what …

  7. How do I make the method return type generic? - Stack Overflow

    May 24, 2016 · Afaik, Java and most typed languages don't overload methods or functions based on return type. For instance public int getValue(String name){} is indistinguishable from public …

  8. How to call a method with a separate thread in Java?

    Aug 15, 2010 · In your "main" thread, create a new Thread class, passing the constructor an instance of your Runnable, then call start() on it. start tells the JVM to do the magic to create a …

  9. What are all the different ways to create an object in Java?

    Within the Java language, the only way to create an object is by calling its constructor, be it explicitly or implicitly. Using reflection results in a call to the constructor method, …

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

    System.out.println("Method is finished!"); Internally I'm using a class that implements Runnable and do some Reflection work to get the correct method object and invoking it. I want some …