Skip to content

Instantly share code, notes, and snippets.

@ssaurel
Created November 30, 2019 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssaurel/999f5d5c26e19143d8c6d0f8022694f3 to your computer and use it in GitHub Desktop.
Save ssaurel/999f5d5c26e19143d8c6d0f8022694f3 to your computer and use it in GitHub Desktop.
Tuple for the Web Crawler on the SSaurel's Blog
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