Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • I think using Map could be a good solution. Also it eliminates nested for loops as well. Commented Jul 11, 2017 at 12:44
  • Why not just check if the student is already in the list? Also, it has no connection with this but you could override your Student#toString method to print it more cleanly Commented Jul 11, 2017 at 12:45
  • @Nathan The problem with that is that the student will be in the list n times where n is the amount of priorities they have. Commented Jul 11, 2017 at 12:48
  • @RohitMourya Can you elaborate on that? Commented Jul 11, 2017 at 12:49
  • @LarsChristensen Then, just check if it exists in the list with the same priority. Commented Jul 11, 2017 at 12:51