Blog Archives

Shuffle an Array or a List in Java

How can we rearrange an array of items in random order? A simple way is to manipulate the array by picking elements randomly. Or we can use Java Collections API. Shuffle an Array Write a loop to go through each

Tagged with: , ,
Posted in Java

A Stack Class in Java

What is a Stack? In English, a stack is a pile of objects. In Computer Science, a stack is a linear collection which allows adding or removing elements from the same end (the top). Stack elements are processed in a

Tagged with: , , , ,
Posted in Java