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;
}
}
|