how can i insert a text file into a hashSet??

R

Roedy Green

Then inside the compare to function do the comparison function.. ??
If so, how would i go about writing a comparison function??

If you have Strings there are two methods for comparing. see
http://mindprod.com/jgloss/gotchas.html#COMPARISON

You might want to trim your strings first.

You Set has a contains method which is a sort of compare.

If you do it the SortedArrayList way with two sorted arrays or
ArrayLists you compare with either equals or equalsIgnoreCase.
or with a Comparator or Comparable. see
http://mindprod.com/jgloss/comparator.html
http://mindprod.com/jgloss/comparable.html
http://mindprod.com/jgloss/sort.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,792
Messages
2,569,639
Members
45,353
Latest member
RogerDoger

Latest Threads

Top