David Burt wrote:I know there are already topics on this exact thing but none of them actually answer my question. is there a way to do this?
if I have a TreeMap that uses strings as the keys and objects of the TreeSet class as the values, is there a way that I can add some int to a set that is associated with a specific key?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
David Burt wrote:something like
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
David Burt wrote:I haven't really done much since I got stuck and this code doesn't work...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
David Burt wrote:in the other part of the project we had to use an AvlTree class from our textbook to do the same thing. AnyType is how the author of that code wrote it. our professor wants us to write code that is intentionally as reusable as possible, so even though in this project we are using it to make a concordance it should be written so that it can be used for any number of things, so that's why I used <AnyType>. to be honest I don't really know what the possible ramifications are of using that and I don't really know how it works. but I guess I'm still learning.
This idea of reusable code is also why I'm leaving it up to the Main to define what is meant by a word or identifier
again if I'm being stupid and making grievous errors please tell me flat out, I'm new at this and the last thing I need is for you to pull your punches so give it to me straight.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
David Burt wrote:Thanks I appreciate the help. I went back and rewrote my code into one class, I got rid of the generics, you're right I need to read up on them before trying to use them. here is the code I have right now, it isn't reusable and only really works for this application but it does work which is the important thing right now.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
David Burt wrote:one last thing. If I use this same code for a HashMap and HashSet just change all the instances of TreeMap to HashMap and all the instances of TreeSet to HashSet, how do I get them alphabetized?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
David Burt wrote:... how do I get them alphabetized?
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|