Skip to content

Commit cb4ff5c

Browse files
committed
BJ hw 1 не компилируется, куча ошибок второй вариант
1 parent 75f8650 commit cb4ff5c

3 files changed

Lines changed: 15 additions & 8 deletions

File tree

File renamed without changes.

‎src/com/urise/webapp/storage/ArrayStorage.java‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,36 @@
88
*/
99
public class ArrayStorage {
1010
Resume[] storage = new Resume[10000];
11-
int size = storage.length;
11+
int size = 0;
1212

1313
public void clear() {
14-
for (int i = 0; i < storage.length; i++) {
14+
for (int i = 0; i < size; i++) {
1515
storage[i] = null;
1616
}
1717
size = 0;
1818
}
1919

20-
public void update(Resume resume) {
21-
System.out.println("Error");
20+
public void update(Resume r) {
21+
for(int i = 0; i < size; i++) {
22+
if (storage[i].getUuid() == r.getUuid()) {
23+
return;
24+
} else {
25+
System.out.println("Error");
26+
}
27+
}
28+
return;
2229
}
2330

2431
public void save(Resume r) {
25-
for (int i = 0; i < storage.length; i++) {
32+
for (int i = 0; i < size; i++) {
2633
storage[i] = r;
2734
}
2835

2936
}
3037

3138
public Resume get(String uuid) {
32-
for(int i = 0; i < storage.length; i++) {
33-
if (storage[i].uuid == uuid) {
39+
for(int i = 0; i < size; i++) {
40+
if (storage[i].getUuid() == uuid) {
3441
return storage[i];
3542
}
3643
}
@@ -52,7 +59,7 @@ public void delete(String uuid) {
5259
*/
5360
public Resume[] getAll() {
5461
Resume[] result = new Resume[size];
55-
for (int i = 0; i < storage.length; i++) {
62+
for (int i = 0; i < size; i++) {
5663
result[i] = storage[i];
5764
}
5865
return result;

0 commit comments

Comments
 (0)