Hi, I have a problem with a method from my work, which I can't seem to find.
So here's the problem: - I have a method called deleteGroup(String name) and, as the name says it's supposed to delete a group from a given array, if the array isn't empty and if the group has the same name has the given one.
Here's the code:
public void deleteGroup(String nameG) {
if (gCounter != 0) {
if (groupExists(groups[0].getName(), nameG)) {
this.groups = new Cgrupo[1];
gCounter = 0;
}
throw new NonExistantGroupException();
}
throw new NonExistantGroupException();
}
(yes it's a one value array, since this is just the 1st phase of the work, next ones will be using maps and list, etc)
well here's the groupExists method, since it appears to block there and throw the NonExistantGroupException:
private boolean groupExists(String name1, String name2) {
return name1.equalsIgnoreCase(name2);
}
So this is my problem, I'm pretty sure it must be an incredible stupid mistake. I hope any of you can point it out, because I have lost all hope in solving this.
Kind regards and thanks for help.