-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implemented class ArrayList #1201
base: master
Are you sure you want to change the base?
Conversation
growIfArrayFull(); | ||
for (int i = 0; i < list.size(); i++) { | ||
growIfArrayFull(); | ||
this.elementData[size] = list.get(i); | ||
size++; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
growIfArrayFull(); | |
for (int i = 0; i < list.size(); i++) { | |
growIfArrayFull(); | |
this.elementData[size] = list.get(i); | |
size++; | |
} | |
for (int i = 0; i < list.size(); i++) { | |
add(list.get(i)); | |
} |
if (index < 0 || index >= size) { | ||
throw new ArrayListIndexOutOfBoundsException("incorrect index"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return size == 0; | ||
} | ||
|
||
public int index(T element) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public int index(T element) { | |
private int getIndex(T element) { |
public class ArrayList<T> implements List<T> { | ||
private static final int DEFAULT_CAPACITY = 10; | ||
private static final double MIN_CAPACITY = 1.5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is not MIN_CAPACITY - think about name
} | ||
} | ||
|
||
private void indexChecker(int index) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private void indexChecker(int index) { | |
private void checkIndex(int index) { |
No description provided.