Given how things have been historically, when we aren't given direction on something, we are free to solve the problem in whatever way seems best to us. We have written our own algorithms and have used Collections.sort() in the past. Basically, I need to figure out the easiest solution to the problem, but I'm an unsure how to think it through correctly.
I changed my sort method, but it still doesn't work of course. How can I think this through. I understand what you guys are saying, and I'm going through the APIs you linked, but I'm not sure how to wrap my head around this. Basically, what I know I need to do is:
1. Iterate through the list
2. As I go through the list check to see if n2 is greater than or less than n1 and adjust their placement accordingly.
3. Keep doing this until I get to the end.
So I'm not sure whether I should use Collections.sort(), or if I should use some other method. Maybe there's a way to apply this.
Thanks. For the reverse, per our instructions, we only have to print it in reverse, we don't actually need to reverse the whole list.
Could you give me an example of how my reverse() method my look if it had a return. We've been using plenty of void methods in my class and plenty of non-void ones, so this is a design idea that I'm unfamiliar with.
I'm having some trouble creating a map for my program below. Below it is an example of what I'm referring to, but there we had an input instead of reading in a text file. How can apply it to what I'm trying to do here.
I am trying to prime this data so I can read it into a serializable file, however I can't get this to prime correctly. Below is the method and my method call.
Here's what I have now. I don't know if I'm using the delimiter correctly or not. I also haven't been able to get the "s" into my print statement either. I'm pretty sure I should be able to remove the .split(",") from my print statement and I'm also pretty sure I won't need the private method at the end, but here's what I've got so far. What does everyone think?
Thanks for all the responses. Just to clarify what I'm trying to do. I have n lines of data, each which are KNOWN to be seven piece of data long. I want to get data piece number 1 from each line, then piece 2, etc. until I reach data piece number 7. Here is what I have now. (I'm cramming this in during my lunch break at work so I haven't been able to test this yet.)
Jeanne, I have a text file (I've already imported the data), and I'm trying to get 1245.67,2541.36, and 2513.45, the first number from each line until I reach the end. This was not originally a String.
I'm trying to print out each piece from the txt file (data below). In my print method, I have it set to divide by three to get the average, but I'm not sure how to get the first number from each line down the line. I have the below, but something tells me I'm off the mark.
Yes, I'd just like to print each last name to the console. If I can do this a completely different way if there's any easier way to do this. I do not need to do it the way I'm doing. Please let me know if there's any easier way to do this.