Код: Выделить всё
[Employee{empId=1, name='Emp1', address='Emp1 Address1'},
Employee{empId=1, name='Emp1', address='Emp1 Address 2'},
Employee{empId=2, name='Emp2', address='Emp2 Address 1'}]
Код: Выделить всё
[EmployeeNormalized{empId=1, name='Emp1',
addresses=[Emp1 Address1, Emp1 Address 2]},
EmployeeNormalized{empId=2, name='Emp2', addresses=[Emp2 Address 1]}]
Код: Выделить всё
class Employee {
private int empId;
private String name;
private String address;
// 50 other properties
public Employee(int empId, String name, String address) {
this.empId = empId;
this.name = name;
this.address = address;
}
// Setters and Getters
}
class EmployeeNormalized {
private int empId;
private String name;
private List addresses;
// 50 other properties
public EmployeeNormalized(int empId, String name, List address) {
this.empId = empId;
this.name = name;
this.addresses = address;
}
// Setters and Getters
}
Код: Выделить всё
List
Обратите внимание, что Класс «Сотрудник» имеет около 50 свойств.
Как создать нормализованную форму списка?
Подробнее здесь: https://stackoverflow.com/questions/709 ... g-the-java