All pastes #283063 Raw Edit

/19/movie/Movie

public java v1 · immutable
#283063 ·published 2006-12-18 01:52 UTC
rendered paste body
// Jim Herreroimport java.util.*;public class Movie implements Comparable<Movie>{  private int year;  private String title;  private Person director;  private LinkedList<Person> actors;  public Movie(int y, String t, Person d, LinkedList<Person> a)  {    year = y;    title = t;    director = d;    actors = new LinkedList<Person>();    for(Person actor : a)      actors.add(actor);  }    public int compareTo(Movie other)  {    //return title.compareTo(other.title);    return director.compareTo(other.director);  }  public String toString()  {    String actorstring = "";    for(Person actor : actors)      actorstring += actor + ", ";    actorstring = actorstring.substring(0, actorstring.length() - 3);    return year + " " + title + " " + actorstring + " Dir: " + director;  }  public LinkedList<Person> getActors()  {    return actors;  }}