所以我有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