public void deleteDvd(String title)
{
String DvdCompare;
Dvd dvdObj;
Collections.sort(dvds);
for(int i = 0;i< dvds.size();i++)
{
DvdCompare = dvds.get(i).getdvdTitle();
dvdObj = dvds.get(i);
if(title.equals(DvdCompare))
{
System.out.println("Dvd is in system");
int index =Collections.binarySearch(dvds,DvdCompare);
dvds.remove(index);
//delete method in arrayList
}
else if (!title.equals(DvdCompare))
{
System.out.println("Not found Dvd Object");
}
}
}
I'm tryin to search through my dvds arraylist, find title of dvd and delete it from the arraylist completely.
I have imported
import java.util.Collections;
import java.util.ArrayList;
E:\Java\dvd>javac Inventory.java
Inventory.java:172: cannot find symbol
symbol : method sort(java.util.ArrayList<Dvd>)
location: class java.util.Collections
Collections.sort(dvds);
^
Inventory.java:180: cannot find symbol
symbol : method binarySearch(java.util.ArrayList<Dvd>,java.lang.String)
location: class java.util.Collections
int index = Collections.binarySearch(dvds,DvdC
ompare);
I get this error above and can't seem to figure it out. any ideas please?
^