Java Java Data Structures Efficiency! Changing Course

Tony Capps
Tony Capps
2,123 Points

Just finished but still need a LOT of help with Data Structures

I'm not sure how much we are supposed to get from this class. However, there is still SO much I don't fully understand. It was difficult enough to just keep up with the typing. There's methods on classes, on map, and lists and remembering all their methods as well...

This is very convoluted. Is there another Data Structures class? Something slower with more descriptions. Also, some graphs showing how we made everything connect.

private Song promptSongForArtist(String artist) throws IOException{ List<Song> songs = mSongBook.getSongsForArtist(artist); List<String> songTitles = new ArrayList<>(); for (Song song : songs) { songTitles.add(song.getTitle()); } System.out.printf("Available songs for %s: %n", artist); int index = promptForIndex(songTitles); return songs.get(index); }

This is one small example of code (a big graph/picture of how we connected all the different classes and methods would be awesome) I'd like to see explained in more detail. Also, in our printf, all we print is the artist, where are all the songs coming from?

How much are we supposed to have retained from going through this lesson? The others I thought were excellent and easy to understand. Am I supposed to still feel very confused? If so, where can I go for more information and help retaining all this information.

Thanks for your help.

In Java every data structure is based on the Collection interface. To have a better understanding of it, take a look at this picture:

Every data structure in Java has a use case. For example if you care about ordered items or need to avoid duplicates. The different data structures make it much easier to handle to data. No one knows all methods of all data structures at a first glance. You will explore them, while implementing. It is more important to understand what each data structure actually represents. For example a "Set". If you understand what a "Set" actually is, than you know that there is no method to get an item from a specific index.

1 Answer

Tony Capps
Tony Capps
2,123 Points

Thanks for the response. I suppose I phrased my question poorly. I understand Data Structures themselves. I'm a CS major at UT and I've had to actually code Hashes, Linked Lists, etc in C. So the basic implementations I get.

I suppose my questions are more syntactical. The picture I want to see is the specific Karaoke program and it's classes and methods' inter-connectedness. I suppose because C is lower level, when I code a Priority Queue, I see every little thing. But a lot happens "under the covers" in Java and I want to make sure I have a good grip on how that all works. I appreciate not having to dereference things, or malloc, etc; but I still want to understand how Java is operating. I think that's why I'm still having troule grasping how we connect different methods and classes and whats going on, and then finally what we are actually getting.

Maybe what I want is out of the scope of this class. But I feel like right now I'd have to constantly reference examples to codes with Java. Especially as it pertains to mixing all these different methods and classes to manipulate the data.