/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import static java.util.stream.Collectors.groupingBy;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{

    public static void main(String[] args) {
        List<Employee> listEmployee = new ArrayList<>();
        listEmployee.add(new Employee("Ravi", "IT", true));
        listEmployee.add(new Employee("Tom", "Sales", false));
        listEmployee.add(new Employee("Kanna", "IT", false));

        Map<String, List<Employee>> employeePerDep = listEmployee.stream().collect(groupingBy(Employee::getDepartement));
        System.out.printf("%10s %10s %10s %10s\n", "Departement", "total", "active", "inactive");

        for (Map.Entry<String, List<Employee>> entry : employeePerDep.entrySet()) {
            int total = entry.getValue().size();
            long active = entry.getValue().stream().filter(Employee::isActive).count();
            System.out.printf("%-10s %10d %10s %10s\n", entry.getKey(), total, active, total - active);
        }
    }
}

class Employee {
    private String name;
    private String departement;
    private boolean active;

    Employee(String name, String sector, boolean active) {
        this.name = name;
        this.departement = sector;
        this.active = active;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    boolean isActive() {
        return active;
    }

    void setActive(boolean active) {
        this.active = active;
    }

    String getDepartement() {
        return departement;
    }

    void setDepartement(String departement) {
        this.departement = departement;
    }
}