This question already has answers here:
Where can I find the Java JDK source code? [closed]
(11 answers)
Closed 6 years ago.
In java, is there any way to access the methods to classes that already you import? For example, is there a way to view the code for all the methods used for arrays? Such as the constructors, add(), remove(), size()? I have checked oracle, but there is no code, only method names and parameters. I understand how the methods work, but i'd like to see the actual code used.
Search for the JDK source code, depending on the version you want.
Related
This question already has answers here:
How to make a lambda expression define toString in Java 8?
(5 answers)
Naming(toString) Lambda-Expressions for Debugging purpose
(2 answers)
Closed 1 year ago.
In our application we have a couple of utility methods that take lambdas as argument to execute misc. activities and among them they then call the passed lambdas.
During development we occasionally had errors in the lambdas, so we emit the lambdas as part of the error message. The default toString() of a lambda at least emits the classname (which is already a BIG help! Otherwise we would never have found some of the issues) but only with a cryptic suffix e.g. "classname_here$$Lambda$2497/0x0000000800e75c40#463f3a95".
For better error logging it would be very helpful if one could give a lambda a more telling name. Is that somehow possible? Can one assign lambdas a name or some "human readable" identification? For classes that contain LOTS of lambdas it can be pretty hard to find out, WHICH lambda caused the issue, so that would be helpful.
This question already has answers here:
Crossed out imported java packages
(2 answers)
Closed 8 years ago.
I tried to call the method .getHours() and Eclipse marks the name of a function with a line.
Why is this happening?
The method is deprecated, e.g., annotated with #Deprecated.
It means you probably shouldn't be using it, since support may disappear in the future.
That mark means that the method has been deprecated. This means the author of the code intends you to avoid that method, but doesn't remove it because of compatibility.
If you check the javadoc is possible the author has left documented an alternative way to perform the behavior.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Get current stack trace in Java
Here is the thing, i want to get a list of all called methods in a java class. So far i've been using eclemma, but that just insn't enough. I also want the order in which the methods have been called.
You can log each method as it is called (with its arguments if you like). You can add a line to each method or use AOP to do this for you.
This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
Using Java Lib with Scala Reserved Words
I'm experimenting with Scala, and a Java library I'm using has a with method on one of its objects, but with is a keyword in Scala. How do I call this method from my Scala code?
From http://ofps.oreilly.com/titles/9780596155957/TypeLessDoMore.html#ReservedWords
Some Java methods use names that are reserved by Scala, e.g., java.util.Scanner.match. To avoid a compilation error, surround the name with single back quotes, e.g., java.util.Scanner.‵match‵.
(edited for formatting)
This question already has answers here:
How to check if a folder exists?
(10 answers)
Closed 7 years ago.
Does anyone know what happened to the path.exists() API method in the latest Java 7 API?
I cannot find the change in the change logs, and between b123 and b130, the method has been removed from the API.I see that there is a static Files.exists method but I'm not sure if that is the replacement or not.
Is anyone following the Java 7 work close enough to know how this should be handled?
Thanks for any help.
Files.exists
Look in the Files class for the static methods exists() and notExists(). Both take a Path.
I guess they decided it made more sense as a static rather than instance method.