Skip to content

Commit

Permalink
STORAGE: refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
kenu21 committed Oct 4, 2024
1 parent c0ade37 commit 434a376
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/main/java/core/basesyntax/impl/StorageImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
public class StorageImpl<K, V> implements Storage<K, V> {

public static final int INITIAL_SIZE = 10;
public static final int LAST_INDEX_NUMBER = 9;

private K[] keys = (K[]) new Object[INITIAL_SIZE];
private V[] values = (V[]) new Object[INITIAL_SIZE];
private int index = 0;

@Override
public void put(K key, V value) {
if (index > LAST_INDEX_NUMBER) {
if (index > INITIAL_SIZE - 1) {
throw new RuntimeException("Too many!");
}
for (int i = 0; i < keys.length; i++) {
Expand Down

0 comments on commit 434a376

Please sign in to comment.