hw3: convert class members to final where possible, make Photo a record class
This commit is contained in:
@@ -8,7 +8,7 @@ import java.util.List;
|
||||
public class SortByDate implements SortingStrategy<Photo> {
|
||||
@Override
|
||||
public List<Photo> sort(List<Photo> photos) {
|
||||
photos.sort(Comparator.comparing(Photo::getDateAdded));
|
||||
photos.sort(Comparator.comparing(Photo::dateAdded));
|
||||
return photos;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.List;
|
||||
public class SortByName implements SortingStrategy<Photo> {
|
||||
@Override
|
||||
public List<Photo> sort(List<Photo> photos) {
|
||||
photos.sort(Comparator.comparing(Photo::getName));
|
||||
photos.sort(Comparator.comparing(Photo::name));
|
||||
return photos;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.List;
|
||||
public class SortBySize implements SortingStrategy<Photo> {
|
||||
@Override
|
||||
public List<Photo> sort(List<Photo> photos) {
|
||||
photos.sort(Comparator.comparing(Photo::getFileSize));
|
||||
photos.sort(Comparator.comparing(Photo::fileSize));
|
||||
return photos;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user