Package model.array

Source Code of model.array.SearchableObjectArray

package model.array;

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

import model.movie.SearchableObject;

public class SearchableObjectArray extends ArrayList<SearchableObject>{
  private static final long serialVersionUID = -3749087838228073144L;

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

Related Classes of model.array.SearchableObjectArray

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.