How to reverse an ArrayList in place in Java - Example

You can reverse an ArrayList in place in Java by using the same algorithm we have used to reverse an array in place in Java. If you have already solved that problem then It's a no-brainer because ArrayList is nothing but a dynamic array, which can resize itself. All elements of an array are stored in the internal array itself. By the way, if you need to reverse an ArrayList then you should be using the Collections.reverse() method provided by Java Collection framework. It's generic method, so you can not only reverse an ArrayList but also Vector, LinkedList, CopyOnWriteArrayList, or any other List implementation. Though, worth noting is that this method internally uses a ListIterator for reversing the list, which might not be as efficient as our algorithm.

Best practices to name your JAR file in Java

If you are an author of an internal, proprietary Java library or an external open source library,  or you are one of those lucky developers who ship Java application by yourself then you should follow these best practices while naming your JAR files. These best practices are a result of the practical experience of using hundreds of Java library and application. Following these best practices will help  in better management of JAR files. It's part of my other best practices articles e.g. best practices while naming variable, writing comments, overriding methods, muli-threading, JDBC, and best practices while dealing with passwords. If you are interested in learning more best practices, you can always search those articles on this blog.

5 Free Data Structure and Algorithm Books in Java Programming

In last article, I have shared 5 good data structure and algorithms books, but those were not free. After that article, I received some feedback about how about free data structure and algorithm books? Fair enough, everybody loves free eBooks, don't you? In the past, I have shared a list of free Java programming books, so I had some idea. I did some more research on internet and checked my collection as well. Fortunately, there are a couple of good Data Structure and Algorithm books which are available for free PDF download or for online reading and in this list we will see some of them. Data Structure and Algorithm is one of the most important topics for any programmer, not just for interview point of view but also about writing good programs and problem solving. A good choice of data structure can reduce the complexity of the algorithm and can improve its performance drastically.