Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Data Structures Exploring the Java Collection Framework Sets

Manish Giri
Manish Giri
16,266 Points

When were those 58 treets loaded in the Treet object? And how?

So I just watched the ArrayList and Set videos, and turns out that there were some more treets loaded at some point. Did I miss a video somewhere Craig shows how to load the 58 treets? The last time treets were loaded - it had about 2 treets as far as I remember, using the Treet class constructor. The most recent workspace doesn't have any information about the new treets. There's only the tweets.ser file so I'm assuming the treets are being deserialized from this file and loaded into a Treet object.

When I write this for loop, I get the treets:

for(Treet treet: treets) {

  System.out.println(treet);
   System.out.println();

}

Can someone show me how the treets were loaded? Did it involve some Twitter API? Of course it would not have been the regular way of creating new treets through the constructor every single time.

2 Answers

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Hey Manish!

Check out this Twitter API Libraries page. I used Twitter4J to do this, it's good for doing searches. The hbc one from twitter is awesome for streaming.

Hope that helps!

Hey Craig I love your videos, I think though that newbies starting out with Data Structures would appreciate more help. A broader explanation of the Twitter API and how you used it would help.

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Hi Manish!

Yeah you are right I load it by deserializing, there is a class called Treets that does the deserialization of an array of Treet objects. I used the Twitter API to get them originally, and made the Treet object array and then serialized it. Unfortunately after a period of time the Treets fall off, so those are locked in time to when I did the video.

Hope that helps!

Manish Giri
Manish Giri
16,266 Points

Thank You, Craig! Is there any way you could point me to some general tips that helps to get started with using Twitter API for extracting tweets? It is something I've wanted to do for a very very long time!