hw3: PhotoAlbumModel: improve performance by returning unmodifiable list rather than copying

This commit is contained in:
Yuri Tatishchev 2025-03-25 00:46:31 -07:00
parent 0fb5fd0654
commit d4705dc11e
Signed by: CaZzzer
GPG Key ID: E0EBF441EA424369

View File

@ -64,7 +64,7 @@ public class PhotoAlbumModel {
} }
public List<Photo> getPhotos() { public List<Photo> getPhotos() {
return new ArrayList<>(photos); return Collections.unmodifiableList(photos);
} }
public Photo getCurrentPhoto() { public Photo getCurrentPhoto() {