2017-01-13 14:28:08 -08:00
|
|
|
// concurrent/StaticIDField.java
|
2021-01-31 15:42:31 -07:00
|
|
|
// (c)2021 MindView LLC: see Copyright.txt
|
2017-01-13 14:28:08 -08:00
|
|
|
// We make no guarantees that this code is fit for any purpose.
|
|
|
|
// Visit http://OnJava8.com for more book information.
|
|
|
|
|
|
|
|
public class StaticIDField implements HasID {
|
|
|
|
private static int counter = 0;
|
|
|
|
private int id = counter++;
|
2021-01-31 15:42:31 -07:00
|
|
|
@Override public int getID() { return id; }
|
2017-01-13 14:28:08 -08:00
|
|
|
}
|