Top rank per group: Difference between revisions

m
imported>Arakov
imported>Arakov
Line 1,674:
class Employee
{
string Name : prop;
string ID : prop;
int Salary : prop;
string Department : prop;
Line 1,684:
.writePaddingRight(ID, 12)
.writePaddingRight(Salary.toPrintable(), 12)
.write:(Department);
}
Line 1,690:
{
topNPerDepartment(n)
= self.groupBy::(x => x.Department ).selectBy::(x)
{
^ new {
Line 1,696:
Employees
= x.orderBy::(f,l => f.Salary > l.Salary ).top(n).summarize(new ArrayList());
}
};
Line 1,720:
};
employees.topNPerDepartment:(2).forEach::(info)
{
console.printLine("Department: ",info.Department);
info.Employees.forEach:(printingLn);
console.writeLine:("---------------------------------------------")
};
Anonymous user