Package model.array

Source Code of model.array.MovieArray

package model.array;

import java.util.ArrayList;
import java.util.Collection;

import model.movie.Movie;

public class MovieArray extends ArrayList<Movie> {
  private static final long serialVersionUID = 6826958774901473062L;
 
  public MovieArray() {
    super();
  }
 
  public MovieArray(Collection <? extends Movie> e) {
    super(e);
  }
 
  @Override
  public boolean add(Movie e) {
    if (!contains(e))
      return super.add(e);
    return false;
  }
 
  public boolean remove(String uri) {
    for (Movie m : this)
      if (m.getUri().equals(uri))
        return remove(m);
    return false;
  }
 
  @Override
  public boolean contains(Object o) {
    if (o instanceof Movie) {
      Movie movie = (Movie) o;
      for (Movie m : this)
        if (m.getUri().equals(movie.getUri()))
          return true;
      return false;
    } else return super.contains(o);
  }
}
TOP

Related Classes of model.array.MovieArray

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.