List<Integer> nums = -something-;
nums = nums.stream()
.map(n -> n * 2)
.filter(n -> n >= 0)
.collect(Collectors.toList());
Math.max(n1, n2);
Math.min(n1, n2);
Math.abs(n);
Math.pow(base, exponent);
Math.sqrt(n);
Math.round(n);
Math.floor(n);
Math.ceil(n);
public class MySort implements Comparator<int[]>{
public int compare(int[] a, int[] b){
return a[0]-b[0];
}
}
Iterator itr = array_name.iterator(); //or list.iterator()
itr.hasNext(); //returns bool
itr.next();
itr.remove(); //removes curr element
Integer.MIN_VALUE;
Integer.MAX_VALUE;
Random r = new Random();
r.nextInt(n); //return a random int from 0 to n
// OR
Math.random(); //returns a random double between 0.0 and 1.0
static int Integer.MAX_VALUE
static int Integer.MIN_VALUE