17 lines
514 B
Java
17 lines
514 B
Java
// validating/CountedList.java
|
|
// (c)2017 MindView LLC: see Copyright.txt
|
|
// We make no guarantees that this code is fit for any purpose.
|
|
// Visit http://OnJava8.com for more book information.
|
|
// Keeps track of how many of itself are created.
|
|
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; }
|
|
}
|