Java

How to Shuffle an Array in Java — step-by-step Programming tutorial on Progressive Robot

How to Shuffle an Array in Java

URL: https://www.progressiverobot.com/shuffle-array-java/ There are two ways to shuffle an array in Java. Collections.shuffle() Method Random Class 1. Shuffle Array Elements using Collections Class We can create a list from the array and then use the Collections class shuffle() method to shuffle its elements. Then convert the list to the original array. package com.journaldev.examples; import java.util.Arrays; […]

Read more
Thread Life Cycle in Java - Thread States in Java — step-by-step Programming tutorial on Progressive Robot

Thread Life Cycle in Java – Thread States in Java

URL: https://www.progressiverobot.com/thread-life-cycle-in-java-thread-states-in-java/ Understanding Thread Life Cycle in Java and Thread States are very important when you are working with Threads and programming for multithreaded environment. From our last tutorial, we can create a [java thread](/community/tutorials/java-thread-example "Java Thread Example – Extending Thread Class and Implementing Runnable Interface") class by implementing Runnable interface or by extending Thread […]

Read more
AtomicInteger in Java — step-by-step Programming tutorial on Progressive Robot

AtomicInteger in Java

Today we will look into AtomicInteger in Java. Atomic operations are performed in a single unit of task without interference from other operations. Atomic operations are necessity in multi-threaded environment to avoid data inconsistency. AtomicInteger ![AtomicInteger, java atomicinteger, atomic integer](images/atomicinteger-java-section-1.png) Let's create a simple multi-threaded program where every thread increments the shared count variable 4 […]

Read more
Comparable and Comparator in Java Example — step-by-step Programming tutorial on Progressive Robot

Comparable and Comparator in Java Example

Comparable and Comparator in Java are very useful for sorting the collection of objects. Java provides some inbuilt methods to sort primitive types array or Wrapper classes array or list. Here we will first learn how we can sort an array/list of primitive types and wrapper classes and then we will use java.lang.Comparable and java.util.Comparator […]

Read more
EasyMock Void Method - expectLastCall() — step-by-step Programming tutorial on Progressive Robot

EasyMock Void Method – expectLastCall()

Sometimes we want to mock void methods. EasyMock expect() method can't be used to mock void methods. However, we can use expectLastCall() along with andAnswer() to mock void methods. EasyMock void method When we use expectLastCall() and andAnswer() to mock void methods, we can use getCurrentArguments() to get the arguments passed to the method and […]

Read more
How To Configure YaCy as an Alternative Search Engine or Site Search Tool — step-by-step Linux tutorial on Progressive Robot

How To Configure YaCy as an Alternative Search Engine or Site Search Tool

YaCy is an alternative, peer-to-peer based search engine. It can be used as an alternative to popular engines like Google, Yahoo, etc. In this guide, we will discuss how to install and configure this tool on an Ubuntu 12.04 VPS. We will then discuss how you can contribute to the global search indexes, or use YaCy to provide a site search tool for your domain.

Read more
CHAT