18 lines
545 B
Java
18 lines
545 B
Java
// verifying/CountedList.java
|
|
// (c)2016 MindView LLC: see Copyright.txt
|
|
// We make no guarantees that this code is fit for any purpose.
|
|
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
|
// A List that keeps track of how many
|
|
// of itself are created.
|
|
package verifying;
|
|
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; }
|
|
}
|