/** * Gets key for an object. * * @param o * the object. */ @Override public String key(V o) { if (o == null) { return "null"; } // If the object is already mapped, use existing key Object id = identifierGetter.apply(o); String key = objectIdKeyMap.get(id); if (key != null) { return key; } // If the object is not yet mapped, map it key = createKey(); objectIdKeyMap.put(id, key); keyObjectMap.put(key, o); return key; }