* mahazuga: Mary Ann
* serepate: Serena
  hgarciah: Henri
* balbakr: Bakr
* ruifan: Rui
* mzelenin: Matthew
* jnp2: Jay
* zeyang: Zejun
  zhang486: Jingyun
* yiwecao: Yiwei
* rthammon: Ryan
* wang686: Jiaxing
* dweissma: Andrew
* kevcao: Kevin
* ssalmero: Salmeron, Santiago (TA)
  luo23: Yawen
  runxzhao: Runxia
* dgerman: German, Dan-Adrian (Primary Instructor)
  creba: Chris

Simplest shortest program that keeps time:

----(in file Three.java we have: 

// https://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html

import javax.swing.Timer; 

public class Three {
  public static void main(String[] args) {
    Timer a = new Timer(200, new Luisteraar());
    // https://docs.oracle.com/javase/8/docs/api/javax/swing/Timer.html
    // System.out.println( a ); 
    a.start(); 
  }
}

----(in file Luisteraar.java we have: 

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;


public class Luisteraar implements ActionListener {
  public void actionPerformed(ActionEvent e) {
    System.out.println("I got it..."); 
  }
}
  
So I am done. 

// https://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html

import javax.swing.Timer; 
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class Three implements ActionListener {
  int steps; 
  public static void main(String[] args) {
    Timer a = new Timer(200, new Three());
    // https://docs.oracle.com/javase/8/docs/api/javax/swing/Timer.html
    // System.out.println( a ); 
    a.start(); 
  }
  public void actionPerformed(ActionEvent e) {
    System.out.println("I got it... " + ++this.steps); 
  }
}

Now I try on silo:

// https://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html

import javax.swing.Timer; 
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JFrame;

public class Three implements ActionListener {
  int steps; 
  public static void main(String[] args) {
    JFrame b = new JFrame(); 
    b.setSize(200, 300); 
    b.setVisible(true); 
    Timer a = new Timer(200, new Three());
    // https://docs.oracle.com/javase/8/docs/api/javax/swing/Timer.html
    // System.out.println( a ); 
    a.start(); 
  }
  public void actionPerformed(ActionEvent e) {
    System.out.println("I got it... " + ++this.steps); 
  }
}

I had to use Xming and create a JFrame to keep things around until timer starts. 

// https://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html

import javax.swing.Timer; 
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JFrame;

public class Three implements ActionListener {
  int steps; 
  public static void main(String[] args) {
    JFrame b = new JFrame(); 
    b.setSize(200, 300); 
    b.setVisible(true); 
    Timer a = new Timer(200, new Three());
    // https://docs.oracle.com/javase/8/docs/api/javax/swing/Timer.html
    // System.out.println( a ); 
    a.start(); 
  }
  public void actionPerformed(ActionEvent e) {
    System.out.println("I got it... " + ++this.steps); 
  }
}

--

import java.util.*; 

public class Player {
  private String name;
  public String getName() {
    return this.name; 
  }
  private int points;
  public int getPoints() {
    return this.points; 
  }
  public Player(String name, int points) {
    this.name = name;
    this.points = points;
  }
  public String toString() {
    return "P(" + this.name + ":" + this.points + ")";  
  }
  public static void main(String[] args) {
    Player a = new Player("Laura", 13); 
    System.out.println( a ); 
    ArrayList<Player> players = new ArrayList<Player>(); 
    players.add(a); 
    players.add(new Player("Larry", 13));
    players.add(new Player("Alex", 15));
    System.out.println(players); 
    
    Collections.sort(players, new ByPoints()); 

    System.out.println(players); 

  }
}

// -----------------------------------------------

// https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html

import java.util.*;

public class ByPoints implements Comparator<Player> {
  public int compare(Player a, Player b) {
    if (a.getPoints() > b.getPoints()) return -1; // keep them this way
    else if (b.getPoints() > a.getPoints()) return 1; // swap them 
    else return a.getName().compareTo(b.getName()); // delegate to Strings 
    // by the way that determination is done through Comparables
  }
}

// -----------------------------------------------

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop
> run Player
P(Laura:13)
[P(Laura:13), P(Larry:13), P(Alex:15)]
[P(Alex:15), P(Larry:13), P(Laura:13)]