private Integer getUniqueId ( Object object ) { Integer id = idCache . get ( object ) ; if ( id == null ) { id = uidGenerator . incrementAndGet ( ) ; Integer existing = idCache . putIfAbsent ( object , id ) ; if ( existing != null ) { return existing ; } } return id ; }
Returns an ID that is guaranteed to be the same for any invocation with equal objects .