@@ -178,37 +178,6 @@ public GeneratedIdentifier getOrCreateIdentifier(RosettaNamed obj) {
178
178
return getOrCreateIdentifier (obj , obj .getName ());
179
179
}
180
180
181
- /**
182
- * Remove an identifier from this scope. Also removes any key synonyms to this identifier.
183
- * Returns the set of keys to the given removed identifier.
184
- *
185
- * @throws IllegalStateException if this scope is closed.
186
- */
187
- public Set <Object > removeIdentifier (GeneratedIdentifier identifier ) {
188
- if (isClosed ) {
189
- throw new IllegalStateException ("Cannot delete an identifier in a closed scope. (" + identifier + ")\n " + this );
190
- }
191
- Set <Object > keys = this .identifiers .entrySet ().stream ()
192
- .filter (e -> e .getValue ().equals (identifier ))
193
- .map (Map .Entry ::getKey )
194
- .collect (Collectors .toSet ());
195
- keys .forEach (k -> {
196
- this .identifiers .remove (k );
197
- removeKeySynonyms (k );
198
- });
199
- return keys ;
200
- }
201
- private void removeKeySynonyms (Object key ) {
202
- Set <Object > synonyms = this .keySynonyms .entrySet ().stream ()
203
- .filter (e -> e .getValue ().equals (key ))
204
- .map (Map .Entry ::getKey )
205
- .collect (Collectors .toSet ());
206
- synonyms .forEach (s -> {
207
- this .keySynonyms .remove (s );
208
- removeKeySynonyms (s );
209
- });
210
- }
211
-
212
181
/**
213
182
* Create an synonym between an object and an already existing identifiable object.
214
183
*
@@ -299,7 +268,7 @@ private void computeActualNames() {
299
268
}
300
269
private LinkedListMultimap <String , GeneratedIdentifier > localIdentifiersByDesiredName () {
301
270
LinkedListMultimap <String , GeneratedIdentifier > result = LinkedListMultimap .create ();
302
- new HashSet <>( identifiers .values ()).forEach (id -> result .put (id .getDesiredName (), id ));
271
+ identifiers .values (). stream (). distinct ( ).forEach (id -> result .put (id .getDesiredName (), id ));
303
272
return result ;
304
273
}
305
274
protected Set <String > getTakenNames () {
0 commit comments