
public class NameFactory extends Object
| Constructor and Description |
|---|
NameFactory()
Creates a new
NameFactory that doesn't know about any
existing names. |
NameFactory(Collection<String> existingNames)
Creates a new
NameFactory that knows about
existingNames. |
| Modifier and Type | Method and Description |
|---|---|
void |
addName(String name)
Reserves a known name.
|
String |
createName(String name)
Creates a new unique name based off of
name and adds it to
the list of known names. |
public NameFactory(Collection<String> existingNames)
NameFactory that knows about
existingNames.existingNames - a list of names that may be null.public NameFactory()
NameFactory that doesn't know about any
existing names.public void addName(String name)
name - a not null nameCopyright © 2018. All rights reserved.