How to Randomize a List in Java using Collections.shuffle() Example

The java.util.Collections class provides shuffle() method which can be used to randomize object stored in a List in Java. Since List is an ordered collection and maintains the order on which objects are inserted into it, you may need to randomize elements if you need them in a different order. Collections.shuffle() method uses default randomness to randomize element but you also have an overloaded version of shuffle() to provide an instance of the java.util.Random object, which can be used to randomize elements. Since this method except for fora List, you can also pass it to LinkedList, VectorCopyOnWriteArrayList, and others, which doesn't implement the RandomAccess method.

Java Enum Tutorial - 10 Things Java Devs Should Know about Using Enum

Apart from the Class and Interface, Enumeration type or Enum is another popular type in Java programming language. Enum allows you to represent a fixed number of well-known things in a type-safe manner e.g. days of the week, days of the month, planets in solar system, buttons on remote control, keys on keyboard and suits on playing cards. Before Enum was introduced, prior to Java 1.5, integer and string constants are used to represent the fixed number of things, known as enum int pattern and enum string pattern as described in classic Effective Java by none other than Joshua Bloch. Though they served the purpose, they had some major drawbacks which resulted in poor quality code.

Top 5 Free JavaScript Books for Beginners - Download PDF or Read Online

The internet is full of good things and one of them is free eBooks and PDF. Programmers can almost run anything by these free books. Earlier I have shared some of the free JavaScript tutorials and in this article, I am going to share 5 good books to learn JavaScript which are free to read online or allow you to download PDF for offline reading. JavaScript is probably another language I recommend someone who knows Java, Why? because it's really ubiquitous. There is almost no website which is not using JavaScript in one or other format. Some use JavaScript for client-side scripting and animation, while other use JavaScript on the server side with libraries like node.js, it forms the unique triangle with HTML and CSS.