Collections
Shuffle
import java.util.*;

public class C
{
	public static void main(String args[])
	{
		ArrayList<Integer> l = new ArrayList<Integer>();

		for(int i = 0; i < 10; i++)
			l.add(i);

		Collections.shuffle(l);

		System.out.println(l);

		Collections.shuffle(l, new Random());

		System.out.println(l);
	}
}
			
Swap
import java.util.*;

public class C
{
	public static void main(String args[])
	{
		ArrayList<Integer> l = new ArrayList<Integer>();

		for(int i = 0; i < 10; i++)
			l.add(i);

		System.out.println(l);

		Collections.swap(l, 3, 4);

		System.out.println(l);
	}
}
			
Reverse
import java.util.*;

public class C
{
	public static void main(String args[])
	{
		ArrayList<Integer> l = new ArrayList<Integer>();

		for(int i = 0; i < 10; i++)
			l.add(i);

		System.out.println(l);

		Collections.reverse(l);

		System.out.println(l);

		Integer array[] = {1, 2, 3, 4};

		System.out.println(Arrays.toString(array));

		List l2 = Arrays.asList(array);
		Collections.reverse(l2);

		System.out.println(l2);
	}
}
			
BinarySearch
import java.util.*;

public class C
{
	public static void main(String args[])
	{
		ArrayList<Integer> l = new ArrayList<Integer>();

		for(int i = 0; i < 10; i++)
			l.add(i);

		Collections.shuffle(l);
		Collections.sort(l);

		System.out.println(l);

		int index = Collections.binarySearch(l, 5);

		System.out.println(index);
	}
}
			
Sort
import java.util.*;

public class C
{
	public static void main(String args[])
	{
		ArrayList<Integer> l = new ArrayList<Integer>();

		for(int i = 0; i < 10; i++)
			l.add(i);

		Collections.shuffle(l);

		System.out.println(l);

		Collections.sort(l);

		System.out.println(l);

		Collections.sort(l, Collections.reverseOrder());

		System.out.println(l);
	}
}
			
Rotate
import java.util.*;

public class C
{
	public static void main(String args[])
	{
		ArrayList<Integer> l = new ArrayList<Integer>();

		for(int i = 0; i < 10; i++)
			l.add(i);

		System.out.println(l);

		Collections.rotate(l, 2);

		System.out.println(l);

		Collections.rotate(l, -2);

		System.out.println(l);
		
		Integer [] array = {1, 2, 3, 4};

		List l2 = Arrays.asList(array);
		Collections.rotate(l2, 2);

		System.out.println(l2);
	}
}
			
Rotate
import java.util.*;

public class C
{
	public static void main(String args[])
	{
		ArrayList<Integer> l = new ArrayList<Integer>();
		Random r = new Random();

		for(int i = 0; i < 10; i++)
			l.add(r.nextInt(4));

		System.out.println(l);

		System.out.println("Frequence of 2: "+Collections.frequency(l, 2));
	}
}
			
Disjoint
import java.util.*;

public class C
{
	public static void main(String args[])
	{
		ArrayList<Integer> l = new ArrayList<Integer>();
		ArrayList<Integer> l2 = new ArrayList<Integer>();

		Random r = new Random();

		for(int i = 0; i < 4; i++)
		{
			l.add(i);
			l2.add(r.nextInt(10));
		}

		System.out.println(l);
		System.out.println(l2);

		System.out.println(Collections.disjoint(l, l2));
	}
}