所以我有2个txt文件,都具有IP列表:在它的端口删除相关领域
我加载列表到自己的linkedlists
public static LinkedList<DataValue> result = new LinkedList<DataValue>();
public static LinkedList<DataValue> badresult = new LinkedList<DataValue>();
他们有一个类值
public static class DataValue {
protected final String first;
protected final int second;
public DataValue(String first, int second) {
this.first = first;
this.second = second;
}
}
试图所以这样做是为了使... 负荷LIST1到结果 加载列表2到badresult
那么所有badresult从结果
除去,以便装载完成
public static void loadList() throws IOException {
BufferedReader br = new BufferedReader(new FileReader("./proxy.txt"));
String line;
String args[];
String first;int second;
while ((line = br.readLine()) != null) {
args = line.split(":");
first = args[0];
second = Integer.parseInt(args[1]);
result.add(new DataValue(first, second));
}
}
public static void loadUsed() throws IOException {
BufferedReader br = new BufferedReader(new FileReader("./usedproxy.txt"));
String line;
String args[];
String first;int second;
while ((line = br.readLine()) != null) {
args = line.split(":");
first = args[0];
second = Integer.parseInt(args[1]);
badresult.add(new DataValue(first, second));
}
}
,这里是我在试图删除的结果都是一样的结果链表
public static void runCleaner() {
for (DataValue badresultz : badresult) {
if (result.remove(badresultz)) {
System.out.println("removed!");
} else {
System.out.println("not removed...");
}
}
}
在'DataValue'中实现'equals'方法 – 2014-11-01 20:55:23