java.sql.Timestamp.before()のサンプルコード

サンプルコード
package com.cft;

import java.sql.Timestamp;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

class Employee {
static int i = 1;
public String name;

Employee(String name) {
this.name = name;
}

public String toString() {
return this.name;
}
}

public class BeforeSample {
public static void main(String[] args) {
Employee name1 = new Employee(“yamada”);
Employee name2 = new Employee(“yokohama”);
int capacity = 100;
BlockingQueue<Employee> queue = new ArrayBlockingQueue<Employee>(capacity);
queue.add(name1);
queue.add(name2);
Timestamp ts1 = Timestamp.valueOf(“1982-08-01 09:01:15”);
Timestamp ts2 = Timestamp.valueOf(“1982-08-01 09:01:16”);
if (ts1.before(ts2)) {
System.out.println(queue.poll() + ” is greater than ” + queue.poll());
} else {
System.out.println(queue.poll() + ” is younger than ” + queue.poll());
}
}
}

結果
yamada is greater than yokohama