I have a Photoalbum class and a Photo class.
The Photoalbum class obviously holds a bunch of photos in an array.
Each photo has a subject, location, date, and path.
I need to make a method to search for a a photo with a certain String path.
I tried:
public void SearchPho(String photoFile)
{
int index = Arrays.binarySearch(alb, photoFile );
System.out.println (index);
}
This gave me this error:
Exception in thread "main" java.lang.ClassCastException: Photo cannot be cast to java.lang.Comparable
at java.util.Arrays.binarySearch0(Arrays.java:2003)
at java.util.Arrays.binarySearch(Arrays.java:1946)
at PhotoAlbum.SearchPho(PhotoAlbum.java:62)
at TestAlbum.main(TestAlbum.java:17)
Any assistance?
(alb is my photo album array)