Skip to content

Instantly share code, notes, and snippets.

Last active December 20, 2020 11:02
What would you like to do?
Article: Law of Demeter - company with instanceof
class Company {
private List<Department> departments;
Map<DepartmentCode, BigDecimal> costPerDepartment() {
.collect(Collectors.toMap(Department::getCode, Department::cost));
private boolean costCentre(Department department) {
return department.getType() instanceof CostCentre;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment