fork download
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

class CpuUsage {
	private float usage;
	public CpuUsage(float f) {
		this.usage = f;
	}
	public float getUsage() {
		return this.usage;
	}

}

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		List<CpuUsage> list = new ArrayList();
		list.add(new CpuUsage(2.0f));
		list.add(new CpuUsage(10.0f));
		list.add(new CpuUsage(22.0f));
		list.add(new CpuUsage(2.4f));
		list.add(new CpuUsage(5.0f));
		CpuUsage u = list.stream().min(Comparator.comparing(CpuUsage::getUsage)).get();
		System.out.println(u.getUsage());
	}
}
Success #stdin #stdout 0.19s 2841600KB
stdin
Standard input is empty
stdout
2.0