Removes a section if it exists. @param name the section's name @return true if the section actually existed @throws IllegalArgumentException when trying to remove the common section
(String name)
| 358 | * @throws IllegalArgumentException when trying to remove the common section |
| 359 | */ |
| 360 | public boolean removeSection(String name) { |
| 361 | String normName = normSection(name); |
| 362 | if (this.commonName != null && this.commonName.equals(normName)) { |
| 363 | throw new IllegalArgumentException("Can't remove common section"); |
| 364 | } |
| 365 | if (hasSection(normName)) { |
| 366 | this.sections.remove(normName); |
| 367 | this.sectionOrder.remove(normName); |
| 368 | return true; |
| 369 | } else { |
| 370 | return false; |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | /** |
| 375 | * Returns all section names in this instance minus the common section if |
nothing calls this directly
no test coverage detected