Chapter

Handling javanull values

From ComputerScienceOne by Dr Chris Bourke

Concepts

  1. How can you sort lists and arrays of students in Java?

    "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,

  2. How should a Comparator order elements in a SortedSet?

    "6 //sortedInts has elements 30, 20, 10 in descending order\n\n7\n\n8 SortedSet<Student> sortedStudents = new TreeSet<Student>(byName);\n\n9 //add students, they will be sorted by name\n\n10 for(Stude

  3. What should you consider when sorting collections or arrays with null values?

    "36.3.2. Handling null values\n\nWhen sorting collections or arrays of objects, we may need to consider the possibility of uninitialized null objects. Some collections allow null element(s) while othe

Handling javanull values | ComputerScienceOne | Bifalgorithm | Bifalgorithm