Note that there are some explanatory texts on larger screens.

plurals
  1. POsorting class content according to few parameters
    primarykey
    data
    text
    <p>I need implement sorting for content of file.</p> <p>Every line of File contain next data: <code>Instructor, Course, Group, Student, Result</code> And can contain few results for the same student.</p> <p><em><strong>for example:</em></strong></p> <pre><code>Paul Schwartz,Introduction to Computer Architecture,I1,Ben Dunkin,88 Muhamed Olji,Object Oriented Programming,I4,Mike Brown,73 ... Paul Schwartz,Introduction to Computer Architecture,I1,Ben Dunkin,96 </code></pre> <p>I need to implement for every instructor </p> <ul> <li>course that is leaded by him; </li> <li>all groups that listened this course (ascending order); </li> <li>for every group <code>Student - Result</code> (descending order); </li> <li>and top 5 <code>Student</code> with higher result from this course. </li> </ul> <p>I made reading from file and created class <code>Item</code>:</p> <pre><code>class Item { private String instructor; private String course; private String group; private String student; private int result; // and add appropriate public getters/setters } </code></pre> <p>In java, we can sort all the elements of this class using one of the two options: class implementing <code>Comparable</code> interface and overriding the <code>compareTo() method</code> or using external <code>Comparator</code> interface with <code>compare() method</code>. But how can we sort different querys of sorting using these options.</p> <ul> <li>how to use <code>compareTo()</code> to satisfy this requirements (or better <code>compare()</code>)?</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload