Skip to content
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

HW4 #8

Open
BondarenkoJek opened this issue Feb 11, 2019 · 1 comment
Open

HW4 #8

BondarenkoJek opened this issue Feb 11, 2019 · 1 comment

Comments

@BondarenkoJek
Copy link

List

  • we do not use iterator

if you do different packages for you realization should be packages for arrayList and for linkedList

  • ArrayList should be without main class, create class test or demo or the same for testing
  • private T[] values; => private Object[] data;
  • ArrayList() --> constructor should be public
  • should be constant private int DEFAULT_CAPACITY = 10
  • in default constructor data should be initialize with DEFAULT_CAPACITY
    data = new Object[DEFAULT_CAPACITY];
  • and if you want should be constructor with parameter capacity
    public ArrayList(int capacity) {
    data = new Object[capacity];
    }
  • method add(int index)
  • values = (T[]) new Object[temp.length + 1]; --> why you did it ???
  • should be helper method which should check index and throw exception if index will be bad
  • method remove should be use this helper method too
  • we dint use method update but if you want should be check index to
  • method get index should return size your arrayList, you return length your array

LinkedList

  • Linked delete this interface
  • delete method main => should be some test class

LOOK ORIGINAL REALIZATION AND FIX YOUR REALIZATION

@BondarenkoJek
Copy link
Author

package name collections.arraylist but inside package arraylist and linkedlist

ArrayList

  • inside method remove should invoke checkIndexExceptio

  • inside method add should not code which resize data, this code should be in different "helper" method

  • in method remove the similar (resize code should be inside helper method)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant