Created
November 30, 2019 21:51
-
-
Save ssaurel/999f5d5c26e19143d8c6d0f8022694f3 to your computer and use it in GitHub Desktop.
Tuple for the Web Crawler on the SSaurel's Blog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.ssaurel.mycrawler; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class Tuple { | |
public static Tuple GENERIC = new Tuple(""); | |
public String href; | |
public List < String > anchors; | |
public Tuple(String k) { | |
this.href = k; | |
anchors = new ArrayList < > (); | |
} | |
public void addValue(String value) { | |
anchors.add(value); | |
} | |
@Override | |
public int hashCode() { | |
final int prime = 31; | |
int result = 1; | |
result = prime * result + ((href == null) ? 0 : href.hashCode()); | |
return result; | |
} | |
@Override | |
public boolean equals(Object obj) { | |
if (this == obj) | |
return true; | |
if (obj == null) | |
return false; | |
if (getClass() != obj.getClass()) | |
return false; | |
Tuple other = (Tuple) obj; | |
if (href == null) { | |
if (other.href != null) | |
return false; | |
} else if (!href.equals(other.href)) | |
return false; | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment