We have the codebase mainly using Java 1.5. We are planning to migrate to Java 7/8. Some of the features of Java 7, i am planning to use
1)Auto close resources.
2)Catching multiple exceptions in one catch block.
3)Using String Switch where we are using dozens of if else for String comparisons.
These features definitely improve the readability but do they add any value beyond that ? Performance or any other advantage? Or any other feature you can think of adding ?(Java 8 has lambdas but as of now not adding this feature!)
Using try-with-resources on AutoCloseables will not just improve readability of the code, but it will make your code more robust as well.
Catching disjoint exception types avoids code duplication, which makes your code easier to maintain.
I'm not a fan of switch statements in general. I prefer to map strings to objects that can perform different tasks through polymorphism. For instance, instead of:
You can do:
Another cool language enhancement you can use with Java 7 is the diamond operator. When initializing a variable of a generic type, you don't have to repeat the generic type arguments in the constructor call:
The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
There are a lot more new features in Java 7 besides the three new language features that you mentioned. Not just new language features, but a lot of enhancements to the standard library. Every new major Java version also comes with performance updates, including, for example, new and better garbage collection algorithms.
I would upgrade straight to Java 8, even if you are not yet planning to use the new Java 8 language features such as lambda expressions, because Java 7 is also already obsolete: Oracle does not provide any free and public updates (bugfixes and security updates) anymore since April 2015. See: Oracle Java SE Support Roadmap.