xUtils源码阅读(4)-MemCacheKey

来源:互联网 发布:清穿记事知华年 编辑:程序博客网 时间:2024/06/11 21:06

该类通过图片的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();    }}


0 0
原创粉丝点击