About 958,000 results
Open links in new tab
  1. wait - How do I make a delay in Java? - Stack Overflow

    How do I make a delay in Java? Asked 11 years, 6 months ago Modified 9 months ago Viewed 2.3m times

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

    1 Java now supports optionals in 1.8, I'm stuck with programming on android so I'm using nulls until I can refactor the code to use optional types.

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

  4. java - When to use static methods - Stack Overflow

    Mar 6, 2017 · I am wondering when to use static methods? Say if I have a class with a few getters and setters, a method or two, and I want those methods only to be invokable on an instance …

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

    Dec 4, 2009 · 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 …

  6. Cannot make a static reference to the non-static method

    2 You can not make reference to static variable from non-static method. To understand this , you need to understand the difference between static and non-static. Static variables are class …

  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. java - Making a mocked method return an argument that was …

    Consider a method signature like: public String myFunction(String abc); Can Mockito help return the same string that the method received?

  9. java - annotation to make a private method public only for test …

    The common way is to make the private method protected or package-private and to put the unit test for this method in the same package as the class under test. Guava has a …

  10. java - Method accepting two different types as parameter - Stack …

    May 28, 2012 · I am writing a method that should accept as its parameter an object of one of two types which do not share a parent type other than Object. For example, the types are Dreams …