question: public static String computeUniqueName ( String [ ] existingNames , String baseName ) { Set < String > nameSet = new HashSet < String > ( Arrays . asList ( existingNames ) ) ; String proposedName = baseName ; int i = 2 ; while ( nameSet . contains ( proposedName ) ) { proposedName = baseName + i ++ ; } return proposedName ; }
target:  Returns a name guaranteed not to be equal to any of provided existing names. This is done by adding an integer suffix to the base name (which itself should not contain any such suffix). For example, if the base name is Foo, and the names Bar and Foo2 are already taken (indicated via the existingNames parameter), then this method would return Foo3.