Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private volatile static AtomicInteger creations = new AtomicInteger(Integer.MIN_VALUE);
- private final int creation;
- {
- creation = creations.getAndIncrement();
- }
- @Override
- public int hashCode() {
- return creation;
- }
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- if (creation == ((Stuff) obj).creation)
- return true;
- else
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement