Is it better using exception or flow control while testing for argument inserted by end-user?
pseudocode:

```
class A{
List listOfPeople;
public void insertName(String name)
{
//if the name is not inserted in the registry it throws a runtime exception
throw new IllegalArgumentException("Please insert a registered name");
}
}

```

or maybe it's better doing the following:

```
class A{
List listOfPeople;
public void insertName(String name)
{
if (!listOfPeople.contains(name){
System.out.println("name not in the list, please insert a registered name");
reInsertName();
}
else
..do stuff..
}
}

```

I have read that throwing exceptions is very expensive.. does it mean that whenever it's possible to not throw them we have to avoid throwing them trying to flow-control the issue?

Thanks, Indeed ItIs