Package model.array

Source Code of model.array.ActorArray

package model.array;

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

import model.movie.Actor;

public class ActorArray extends ArrayList<Actor> {
  private static final long serialVersionUID = 254557710697699104L;

  public ActorArray() {
    super();
  }
 
  public ActorArray(Collection <? extends Actor> e) {
    super(e);
  }
 
  @Override
  public boolean add(Actor e) {
    if (!contains(e))
      return super.add(e);
    return false;
  }
 
  public boolean remove(String uri) {
    for (Actor a : this)
      if (a.getUri().equals(uri))
        return remove(a);
    return false;
  }
 
  @Override
  public boolean contains(Object o) {
    if (o instanceof Actor) {
      Actor actor = (Actor) o;
      for (Actor a : this)
        if (a.getUri().equals(actor.getUri()))
          return true;
      return false;
    } else return super.contains(o);
  }
}
TOP

Related Classes of model.array.ActorArray

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.