Sort elements of Java ArrayList Example

Want to learn quickly?
Try one of the many quizzes. More than Java 400 questions with detailed answers.

Add Comment

  • This program helped me a of and helped me in thinking for a solution in a new best way thank you.
    me: Shamiem Ahmad Mir.

  • When I try to apply the sort method to the Collections, I get the error:

    Bound mismatch: The generic method sort(List<t>) of type Collections is not applicable for the arguments (ArrayList<mvccontact>). The inferred type MVCContact is not a valid substitute for the bounded parameter <t extends=”” comparable<?=”” super=”” t=””>>

    what can I do?

    • u need to implements Comparable?
      sort method working (Observer dp it mean u got final algorithm of comapreTo and swap u need to give the comapreTo by implements Comparable)


Facebook Fans