OnJava8-Examples/validating/CountedList.java

17 lines
514 B
Java
Raw Normal View History

2016-08-29 07:27:53 -06:00
// validating/CountedList.java
// (c)2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
2016-09-23 13:23:35 -06:00
// Visit http://OnJava8.com for more book information.
2016-08-31 12:30:03 -06:00
// Keeps track of how many of itself are created.
2016-08-29 07:27:53 -06:00
package validating;
import java.util.*;
public class CountedList extends ArrayList<String> {
private static int counter = 0;
private int id = counter++;
public CountedList() {
System.out.println("CountedList #" + id);
}
public int getId() { return id; }
}