jlperry_2009 0 Newbie Poster

I am having a problem understanding how to sort a set. I have read the Big Java book, and I still don't understand how to do it. Could someone please assist.

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package realestate;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 *
 * @author Kim_Ackers
 */
public class Main
{

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws FileNotFoundException
    {
        // TODO code application logic here

        Scanner realEstate = new Scanner(System.in);
        System.out.print("Please enter the file name to import:");
        String input = realEstate.nextLine();
        System.out.println(input);
        System.out.println(input.length());
        if (input.length() != 0)
        {
//System.out.println(input);
            FileReader userInput = new FileReader("listings.txt");
            Scanner inputFile = new Scanner(userInput);
//System.out.println(input);
        while (inputFile.hasNextLine())
                 {
                     //String line = inputFile.nextLine();
                     //out.println("/* " + lineNumber + " *?" + line);
                     //lineNumber++;                 
            String file = inputFile.nextLine();
            //System.out.println(file);
            String propertyType = file.substring(9, 21);
            String propertyType2 = file.substring(35);
            String propertyType3 = file.substring(24, 34);
            propertyType = propertyType.toUpperCase();
            //System.out.println(propertyType);
            Set <String> propertyTypeS = new HashSet<String>();
            propertyTypeS.add(propertyType);
            propertyTypeS.add(propertyType2 + " " + propertyType3);
            //for (String propertyTypeX: propertyTypeS ) {
            //    System.out.println(propertyTypeX);
            //}
        }
        }
        
        else if (input.length() == 0)
        {


        }
        System.out.close();



        //String propertyType = file.substring(9, 20);
        //propertyType = propertyType.toUpperCase();



    System.exit(0);

    }

}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.