Posts

What's New in JAVA 8

Finally Java 8 released under oracle leadership with many features and enhancements. Though some of the popular JSR's like JSR 294 (Jigsaw) are deferred again to next release, Java 8 still be the largest ever upgrade to java after it was introduced in 1996.  Lets see one of those improvements.  Performance improvement of java.util.HashMap under high hash-collision conditions : Just to give a little background : HashMap is used to store key-value pairs in no.of buckets technically 'Entry' objects . Entry is an inner class of HashMap. Please click  here to see the source code in java 7. Each bucket has a unique number called hash code. When you try to put a key-value pair into the map, the hashmap will look at the hash code of the key, and store the pair in the bucket of which the identifier is the hash code of the key. Let's say if hash code of two keys are same then hash-collision occurs. Till now (prior to Java 8), hash collision is addressed by creati

Singleton Design Pattern

We need to create a class which can have only one instance at any time. Solution 1: public class MySingleton { private static MySingleton singleton= new MySingleton(); private MySingleton(){ System.out.println( "Object Created" ); } public static MySingleton getMySingleton(){ return singleton; } } Let's create the object when we need it, not at the time of loading the class. Solution 2(with Lazy loading): public class MySingleton { // Line : 1 private static MySingleton singleton=null; // Line : 2 private MySingleton(){ System.out.println( "Object Created" ); } // Line : 3 public static MySingleton getMySingleton(){ // Line : 4 if(singleton == null) // Line : 5 { singleton = new MySingleton();

Building memory efficient JAVA applications

http://domino.research.ibm.com/comm/research_people.nsf/pages/sevitsky.pubs.html/$FILE/oopsla08%20memory-efficient%20java%20slides.pdf

REST IN PEACE - JAVA 6

According to Oracle, Java SE 6 will no longer be publicly available after this July. 

Making your PC ready to develop android apps

Learning Android is one of  my resolution of this year, don't know how far I going to make it... let's start with the first step of making your PC ready with all the bunch of installations. 1) install JDK 1.6 -- download jdk 1.6 2) install Eclipse indigo 3.7.1 -- download Eclipse 3) In Eclipse go to Help --> Install new software --> Add      Enter the below details          Name     : ADT (you can give what ever)          Location : https://dl-ssl.google.com/android/eclipse/      Click OK and Finish. 4) Restart Eclipse when it asked. While starting eclipse, it will prompt you to download the android SDK or               you can give the location if you already have in your mechine. Now your system is ready to develop android apps.....

Importing a Oracle Dataset with impdp

1)Login to Oracle with admin user(ex: system). 2)Execute the below script. create directory expdp_dir as '<directory where the dataset resides>'; 3)exit the Oracle and run the below command. impdp DIRECTORY=expdp_dir DUMPFILE=<dump file name> FULL=y LOGFILE=impfull.log Note: If you have multiple dump files to import, you can use comma(,) separated file names in DUMPFILE argument.  

Which one is Better Vector or SynchronizedList

Vector and SynchronizedList are synchronized. In case of vector the synchronization is at method level, Example: public synchronized E get(int index) { return (E)elementData[index]; } And in case of SynchronizedList, the statements within the methods are synchronized on the list object. SynchronizedList is static inner class inside collections class which implements list interface and necessary methods using synchronized blocks like below. Link to Source code Example : public E get(int index) { synchronized(colobj) {return list.get(index);} } where colobj is the collection object. When you do Collections.synchronizedList(new ArrayList()); you end up creating 2 instances of List. Whereas, in case of Vector, you are creating only one instance.