I have a class (ClassOne) that has a list of instanced Classes(Process) and i\'m trying to figure out how to sort them based on their priority int.
public class C
with java 8+ you can try this code below:
import java.util.*;
import java.util.stream.Collectors;
public static void InsertionSort()
{
System.out.println(processList.get(0).name);
System.out.println(processList.get(1).name);
System.out.println(processList.get(2).name);
processList=processList.stream()
.sorted((o1,o2)->{return o1.priority-o2.priority;})
.collect(Collectors.toList());
System.out.println(processList.get(0).name);
System.out.println(processList.get(1).name);
System.out.println(processList.get(2).name);
}