I have a movie class which is derived from a media class. I made an arraylist of movie objects called "movies" and want to be able to sort the arraylist according to one of the movie's attributes -title of movie(sort by name of movie alphabetically essentially). To do get the names of each Movie I have done the below, but now I want to create a newarraylist that is sorted by the name of the movie alphabetically.
// Get name of each individual movie
System.out.println(movies);
length=movies.size();
for (int i=0; i<length;i++){
Movie tempMov = (Movie) movies.get(i);
System.out.println(tempMov.getName());
}
Things I want to know/understand how to do: -How can I sort an arraylist alphabetically (and numerically alphabetically for watchtime as a seperate sort) according to the attributes of an object?
code below should explain most of what I have done
I have tried googling but due to being new to Java I am quite overwhelmed. Any help would be appreciated! The imgur link demonstrates the code I have got (only the important parts). Thanks!