Concept
How can you sort lists and arrays of students in Java?
ComputerScienceOne / Handling javanull values
"36. Searching & Sorting\n\n1 List<Student> roster = ...\n\n2 Student rosterArr[] = ...\n\n3 Comparator byName = ...\n\n4 Comparator byGPA = ...\n\n5\n\n6 //sort by name:\n\n7 Collections.sort(roster, byName);\n\n8 Arrays.sort(rosterArr, byName);\n\n9\n\n10 //sort by GPA:\n\n11 Collections.sort(roster, byGPA);\n\n12 Arrays.sort(rosterArr, byGPA);\n\nCode Sample 36.2.: Using Java Collection’s Sort Method"
Related Ideas
- What should you consider when sorting collections or arrays with null values?ComputerScienceOne · Handling javanull values
- How does Java sort arrays and lists with comparators?ComputerScienceOne · Sorted Collections
- How does Java perform binary searches on arrays and lists?ComputerScienceOne · Sorted Collections
- What is type juggling in PHP?ComputerScienceOne · Handling Null Values in Java Comparators . . . . . . . . . . . . . . . . .
- What are sorted collections in the Java Collections framework?ComputerScienceOne · Sorted Collections