About 23,500,000 results
Open links in new tab
  1. What is the difference between == and equals () in Java?

    The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x and y, this method returns true if and only if x and …

  2. java - How do I test a class that has private methods, fields or inner ...

    Aug 29, 2008 · How do I use JUnit to test a class that has internal private methods, fields or nested classes? It seems bad to change the access modifier for a method just to be able to run a test.

  3. How do I time a method's execution in Java? - Stack Overflow

    How do I get a method's execution time? Is there a Timer utility class for things like timing how long a task takes, etc? Most of the searches on Google return results for timers that schedule

  4. java - What is the Simplest Way to Reverse an ArrayList ... - Stack ...

    May 26, 2012 · The third option is to create a view in reversed order. This is a more complicated solution, and worthy of further reading/its own question. Guava's Lists#reverse method is a viable …

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

    You may use Java Method Invocation Builder to automatically generate the builder with default values. Just add @GenerateMethodInvocationBuilder to the class, or interface, and the @Default to …

  6. How do I determine whether an array contains a particular value in Java ...

    Jul 15, 2009 · I really miss a simple indexOf and contains in java.util.Arrays - which would both contain straightforward loops. Yes, you can write those in 1 minute; but I still went over to StackOverflow …

  7. Java synchronized method lock on object, or method?

    In Java synchronization,if a thread want to enter into synchronized method/block, it will acquire the lock on: all synchronized non-static methods of this object

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

    More answers on how to use a Lambda function, or pass it as a parameter: simple example parameter as a function java.

  9. java - Difference between Static methods and Instance methods - Stack ...

    Instance method are methods which require an object of its class to be created before it can be called. Static methods are the methods in Java that can be called without creating an object of class.

  10. java - Testing Private method using mockito - Stack Overflow

    Jan 10, 2012 · Put your test in the same package, but a different source folder (src/main/java vs. src/test/java) and make those methods package-private. Imo testability is more important than privacy.