0

I have some Twitter data and I am trying to work out which Tweeter posts the least amount of tweets in the data. I have created a Treemap called Tweeters to hold the values in. My code is as follows:

TreeMap<String, Tweeter> tweeters = new TreeMap<String, Tweeter>();

        // read in CSV files using external library opencsv

        reader = new CSVReader(new FileReader(fileName),',', '"');

        while ((nextLine = reader.readNext()) != null) {
            String screenName = nextLine[6];
            String tweetID = nextLine[0];

            Tweet t = new Tweet(tweetID);
            Tweeter x = new Tweeter(screenName);
            // not sure where to go from here


        }

I'm pretty new to Java so any help would be much appreciated. Thanks guys

daniel3412
  • 327
  • 1
  • 3
  • 13
  • You may add the data like this `tweeters.put(screenName, x)` and start debugging out what are you trying to do. By default the treemap is key ordered. To order by value you can use a Comparator. http://www.tutorialspoint.com/java/java_treemap_class.htm – Marcs Dec 02 '14 at 21:56
  • Thanks guys, I'll give this a go – daniel3412 Dec 02 '14 at 22:01

0 Answers0