JAVA: Preventing Duplicate Entries to an ArrayList
问题 I am trying to prevent duplicate entries from being added to an ArrayList as the list is being populated whilst reading through each line of a file. Each line of the file is in the format "node1 node2" (tab delimiter). A duplicate here could either be "node1 node2" or "node2 node1". Here is my code to try and perform this operation: while((line = bufferedReader.readLine()) != null) { String delimiter = "\t"; String[] tempnodelist; tempnodelist = line.split(delimiter); for (int i=0; i <=