About 204,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. java - When is it OK to create object of a class inside a method of ...

    Oct 24, 2012 · Is it not strange to create an object in the definition of the same class than in response the object create a new object then this new object create another and the infinite …

  3. Writing a function inside the main method - Java - Stack Overflow

    When Java 8 comes out, the Closure/Lambda functionality should make it so that you can define the max method in the main method. Until then, you'll only be able to define a method in the …

  4. 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 …

  5. java - How to add custom method to Spring Data JPA - Stack …

    I am looking into Spring Data JPA. Consider the below example where I will get all the crud and finder functionality working by default, and if I want to customize a finder, that can be also …

  6. How to create a directory in Java? - Stack Overflow

    Sep 3, 2010 · How do I create Directory/folder? Once I have tested System.getProperty("user.home"); I have to create a directory (directory name "new folder" ) if …

  7. java - why can't I create a method in the main method - Stack …

    Sep 29, 2013 · 7 Java does not allow to create methods within a method. This is a general rule and NOT specific to main method.

  8. 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 …

  9. 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 …

  10. Sending HTTP POST Request In Java - Stack Overflow

    Jul 24, 2010 · Sending a POST request is easy in vanilla Java. Starting with a URL, we need t convert it to a URLConnection using url.openConnection();. After that, we need to cast it to a …