AutoboxingAutoboxing, introduced in Java 5, is the automatic conversion the Java compiler makes between the primitive (basic) types and their corresponding object wrapper classes (eg, int and Integer, double and Double, etc). The underlying code that is generated is the same, but autoboxing provides a sugar coating that avoids the tedious and hard-to-read casting typically required by Java Collections, which can not be used with primitive types.Example
Prefer primitive typesUse the primitive types where there is no need for objects for two reasons. Primitive types may be a lot faster than the corresponding wrapper types, and are never slower. The immutability (can't be changed after creation) of the wrapper types may make it their use impossible. There can be some unexepected behavior involving == (compare references) and .equals() (compare values). See the reference below for examples. References
|
This video highlights the features available in Health Center. Health Center is a low-processor and memory usage diagnostic tool for monitoring the status of a running IBM Java Virtual Machine (JVM). Health Center provides live information and recommendations in each of the following areas: - Classes: information about classes being loaded - Environment: details of the configuration and system of the monitored application - Garbage Collection: information about the Java heap and pause times - Locking: information about contention on inflated locks - Profiling: sampling profile of Java methods including call paths
Comments
Post a Comment