ViewHolder.java :  » File » mandfilebrowser » com » marcnuri » android » widget » Android Open Source

Android Open Source » File » mandfilebrowser 
mandfilebrowser » com » marcnuri » android » widget » ViewHolder.java
package com.marcnuri.android.widget;

/**
 * @author Marc Nuri San Flix
 * 
 *  Class to hold static references to data + view 
 *  Implementations must include Other fields such as TextView, ImageView...
 *  */
public class ViewHolder<T> {
  // back reference to our list object
  public T data;

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((data == null) ? 0 : data.hashCode());
    return result;
  }

  @SuppressWarnings("unchecked")
  @Override
  public boolean equals(Object obj) {
    if (this == obj)
      return true;
    if (obj == null)
      return false;
    if (getClass() != obj.getClass())
      return false;
    ViewHolder other = (ViewHolder) obj;
    if (data == null) {
      if (other.data != null)
        return false;
    } else if (!data.equals(other.data))
      return false;
    return true;
  }
  
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.