Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.Comparator;
- public class Program {
- int one, two;
- Program ( int one, int two ) {
- this.one = one;
- this.two = two;
- }
- public int getOne() {
- return one;
- }
- public int getTwo() {
- return two;
- }
- public static void main(String[] args) {
- ArrayList<Program> array = new ArrayList<Program>();
- array.add(new Program(1,2));
- array.add(new Program(3,4));
- array.add(new Program(5,6));
- array.add(new Program(7,8));
- array.add(new Program(9,10));
- int min = 0;
- // for ( Program i : array ) {
- // if (i.one > min)
- // min = i.one;
- // System.out.println(i.one);
- // }
- array.sort(Comparator.comparing(Program::getOne().reverseOrder());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement