aboutsummaryrefslogtreecommitdiff
path: root/WordPress/src/main/java/org/wordpress/android/models/ReaderUrlList.java
blob: 17c97f1eb4c7e7985ab6641003f6b12040461708 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package org.wordpress.android.models;

import org.wordpress.android.util.UrlUtils;

import java.util.HashSet;

/**
 * URLs are normalized before being added and during comparison to ensure better comparison
 * of URLs that may be different strings but point to the same URL
 */
public class ReaderUrlList extends HashSet<String> {
    @Override
    public boolean add(String url) {
        return super.add(UrlUtils.normalizeUrl(url));
    }

    @Override
    public boolean remove(Object object) {
        if (object instanceof String) {
            return super.remove(UrlUtils.normalizeUrl((String) object));
        } else {
            return super.remove(object);
        }
    }

    @Override
    public boolean contains(Object object) {
        if (object instanceof String) {
            return super.contains(UrlUtils.normalizeUrl((String) object));
        } else {
            return super.contains(object);
        }
    }


}