How to judge the efficiency of Java code
I just realized that from a computational point of view, I don't know how to judge whether a piece of Java code is valid Reading several source codes, sometimes I think the code I'm reading is very inefficient, sometimes I think the opposite
Can you list the basic single line rules and why they are so important?
Edit - my problems are related to the Java implementation of the JVM, such as Java allocation, string management, exception handling, thread synchronization, etc
Thank you in advance
PS: don't take the literal meaning of "single line"
Solution
If you really need a list of rules you should follow in Java, please check Joshua Bloch's Book Effective Java This book not only provides a performance guide, but also provides the correct method of Java programming