Polevoy S.V Lab_work7 #8

Closed
ChipsEater wants to merge 8 commits from LabWork07 into LabWork06
Showing only changes of commit 8d85818dae - Show all commits

View File

@ -20,7 +20,11 @@ public class SetArtilleriesGeneric<T> {
}
public int insert(T artillery, int position) {
if (position < 0 || position > getCount() || getCount() == _maxCount) {
if (getCount() == _maxCount) {
throw new StorageOverflowException(_maxCount);
}
if (position < 0 || position > getCount()) {
return -1;
}
@ -37,6 +41,10 @@ public class SetArtilleriesGeneric<T> {
T result = _places.get(position);
if (result == null) {
throw new ArtilleryNotFoundException(position);
}
_places.remove(position);
return result;