You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
710 B

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<Movie> movies = new ArrayList<>();
public void add(Movie movie) {
if (movie == null) throw new IllegalArgumentException();
movies.add(movie);
}
public void addAll(List<Movie> list) {
movies.addAll(list);
}
public List<Movie> getAll() {
return Collections.unmodifiableList(movies);
}
public void clear() {
movies.clear();
}
public int size() {
return movies.size();
}
}