Migrate Java code to separate QL repo.

This commit is contained in:
Pavel Avgustinov
2018-08-30 10:48:05 +01:00
parent d957c151a6
commit 846c9d5860
2319 changed files with 134386 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
public class Customer {
private static List<Customer> customers;
public void initialize() {
// AVOID: Static field is written to by instance method.
customers = new ArrayList<Customer>();
register();
}
public static void add(Customer c) {
customers.add(c);
}
}
// ...
public class Department {
public void addCustomer(String name) {
Customer c = new Customer(n);
// The following call overwrites the list of customers
// stored in 'Customer' (see above).
c.initialize();
Customer.add(c);
}
}