Mike explained, what I wanted to convey. I think you'll need to re-factor your code, a bit. It will be better if you can debug your code line-by-line to see the values contained in your variables(lists etc.).
Lines 43-45 in your code don't seem to do anything that will solve your objective.
List < String > list = Arrays.asList(publisher);
Collections.sort(list);
printNonDuplicates (list);
for each while loop iteration:
1) you are creating a List object having the single
String object having the publisher name(extracted for each line in your data file).
2) calling sort on the above list having only one element(It will have no effect as you've only one element in the list).
3) and then passing this single-element list object to your method. As your list contains only one string object, this method just ends up printing the publisher name that was set on line 43 to console.
and these 3 steps are performed for every line in your data file.
Instead,
i)try defining your List
before while loop.
List < String > list = new ArrayList<String>();
ii) comment lines 43 and 44 and put list.add(publisher);
iii) move printNonDuplicates (list);
after while loop.
iv) change code in line 73 to : Set < String > set = new TreeSet < String > (collection );
Hope it helps.