You have to use array of Object to store the element and then provide the functionality of adding,seraching and removing the element.This is the way you can create
your own arrayList without using Collections.
1. Make an array of Object holding some predefined number of objects.
2. Take a double variable indicating loadFactor.
3. if the length of the occupied array elements becomes three fourth(or the value of the loadFactor)
3.1 Create an array of Object with size double of the original array.
3.2 copy content of original array to this new array.
3.3 return the new array and delete old array
your own arrayList without using Collections.
1. Make an array of Object holding some predefined number of objects.
2. Take a double variable indicating loadFactor.
3. if the length of the occupied array elements becomes three fourth(or the value of the loadFactor)
3.1 Create an array of Object with size double of the original array.
3.2 copy content of original array to this new array.
3.3 return the new array and delete old array
No comments:
Post a Comment