Introduction Often we have seen developers using arrays. It is a simple data structure that always we can trust and can be implemented very easily. Java has made the handling of the array very simple. Here I am planning to bring in the features like how to optimize the usage of arrays. Need for Arrays We can live with the new generic collection specific to the primitive data types. Still one would argue that the java collection framework is not the only solution for handling collection. I can see a typical process where the size/type of the collection is determined in any problem then the best way to use the collection is 'Arrays'. I am just summarizing the list of static methods in the java.util.Arrays class and with brief description of what the method does. Reference : Java doc 6 Array Manipulation Use the methods inside the utils for better speed optimization to handle collection. Mostly these are tested and proven techniques. Like the 'fill' and '
Showing posts from May, 2011
- Other Apps
The current Java developers start using eclipse from the day 1 and often forget the basic idea of path and classpath. Of even I have seen some experienced developers making such mistakes in understanding the basic difference. Let me start by putting some words that can make sence. Path : This is used by the OS to locate the executables. Any path defined inside this will refer to the location of the path. For e.g., if you want to have javac available to the entire shell/command prompt then you can set the path to the bin directory in the path. I am assuming that the JAVA_HOME environment variable is pointing to your JDK installation folder. Unix: set PATH=$PATH:$JAVA_HOME/bin Windows: set PATH=%PATH%;%JAVA_HOME%\bin This is good practice to use the existing values something like x = x + "new value" cos we also preserve the existing path that was set for other runtime applications. Classpath: This is mainly used by the JDK and the JRE. JDK will use this setting for com
- Other Apps