Monthly Archives: December 2016

How to Sort List of Objects By Using Comparable in Java?

Oracle JavaThere are different approach to sort your custom object or List of Custom object in java. First of all, we have to understand what we are trying to sort. Let me classify in two group broadly, first natural ordering and second, non-natural sorting ( complex sorting). java.lang.Comparable interface is used to sort the object in natural order. The sorting of natural order is very simple by implementing Comparable interface.
Continue reading How to Sort List of Objects By Using Comparable in Java?

Sorting of Stack in Java

Oracle JavaWell, when I heard first time about sorting of stack, I thought why we required to sort of any stack. Initially I thought , this is rubbish and time pass thing, but later point of time, realize this can be interview question. In-fact, most of the interviewer ask this question, how to sort stack in java. I tried to demonstrate the exercise of writing program of sorting stack in java.
Continue reading Sorting of Stack in Java

How to Implement Fixed Size Stack in Java

Oracle JavaStack is ADT type of data structure which has different implementation for different purpose for fulfilling of different contextual requirement. In this article tried to implement how to implement by using fixed size array based implementation. If you want to know something basic about Stack, you can visit What is Stack Data structure.

Continue reading How to Implement Fixed Size Stack in Java