package com.example.moviecli.repository; import com.example.moviecli.model.Movie; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class MovieRepository { private final List movies = new ArrayList<>(); public void add(Movie movie) { if (movie == null) throw new IllegalArgumentException(); movies.add(movie); } public void addAll(List list) { movies.addAll(list); } public List getAll() { return Collections.unmodifiableList(movies); } public void clear() { movies.clear(); } public int size() { return movies.size(); } }