您的位置:首页 > 数据库 > Memcache

xUtils源码阅读(4)-MemCacheKey

2016-09-19 16:21 393 查看
该类通过图片的url和显示参数,生成hashcode以供使用。

功能简单,单一。

源码:

/**
* Created by wyouflf on 15/10/20.
*/
/*package*/ final class MemCacheKey {
public final String url;
public final ImageOptions options;

public MemCacheKey(String url, ImageOptions options) {
this.url = url;
this.options = options;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

MemCacheKey that = (MemCacheKey) o;

if (!url.equals(that.url)) return false;
return options.equals(that.options);

}

@Override
public int hashCode() {
int result = url.hashCode();
result = 31 * result + options.hashCode();
return result;
}

@Override
public String toString() {
return url + options.toString();
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: