Tag: java collections

Singleton List with singletonList()

August 26, 2011 · 2 min read
##### What is singleton?

Java Rotate elements with rotate()

August 23, 2011 · 1 min read
The [Collections](http://way2java.com/collections/collections-api-methods/) algorithms includes a typical method **rotate()** that rotates the elements in cyclic order. After the last few elements, the first elements can be moved. This method is useful to change the order of elements. Note, it is not swapping or shuffling. In shuffling, elements are moved in between randomly. But here, only the order of elements is changed; what elements should come later than the other. You get better idea when you go through the following program.

Copy one list to another with copy()

August 21, 2011 · 2 min read
The **[Collections.copy()](http://way2java.com/collections/collections-api-methods/)** method takes two list objects as parameters. The first one is the destination list and the second is the source list. The source list elements are copied into target list. Here, copy operation does actually replacement.
← Prev
Page 2 of 3
Next →