I am trying to create a Boolean method to resize my array and return true if widening or false for narrowing! here is what I have done so far, please help me i don't know what tod od for the rest:)
public class StringArray implements InterfaceStringArray{
String[] strArray; // create an array & store value
private int nElems =0; // number of elements
final int ARRAY_MAX = 100;
StringArray bubbleSort= new StringArray(); // create bubbleSort object
StringArray selectSort = new StringArray(); // create selectSort object
StringArray insertSort = new StringArray(); // create insertSort object
public void initialize (int arrSize) { //initializes an array of size=arrSize
strArray = new String [arrSize];
}
public int getSize() { //returns the current array size
return strArray.length;
}
public boolean resize(int newSize) { //returns true if successful (widening), false if narrowing
String[] newArray = new String[ strArray.length * 2];
for ( int x=0; x < strArray.length; x++){ // Load array
if (newArray[x].equals(strArray[x]) )
return true;
}
return false;
}
ArrayList<String>?