2016-08-29 07:27:53 -06:00
|
|
|
// validating/CountedList.java
|
2016-12-30 17:23:13 -08:00
|
|
|
// (c)2017 MindView LLC: see Copyright.txt
|
2016-08-24 16:28:10 -06:00
|
|
|
// 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;
|
2016-08-24 16:28:10 -06:00
|
|
|
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; }
|
|
|
|
}
|