Code improvements.
This commit is contained in:
		| @@ -7,7 +7,7 @@ package com.iluwatar; | |||||||
|  */ |  */ | ||||||
| public class CoffeeMakingTask extends Task { | public class CoffeeMakingTask extends Task { | ||||||
|  |  | ||||||
| 	private static int TIME_PER_CUP = 300; | 	private static final int TIME_PER_CUP = 300; | ||||||
| 	 | 	 | ||||||
| 	public CoffeeMakingTask(int numCups) { | 	public CoffeeMakingTask(int numCups) { | ||||||
| 		super(numCups * TIME_PER_CUP); | 		super(numCups * TIME_PER_CUP); | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ package com.iluwatar; | |||||||
|  */ |  */ | ||||||
| public class PotatoPeelingTask extends Task { | public class PotatoPeelingTask extends Task { | ||||||
|  |  | ||||||
| 	private static int TIME_PER_POTATO = 500; | 	private static final int TIME_PER_POTATO = 500; | ||||||
| 	 | 	 | ||||||
| 	public PotatoPeelingTask(int numPotatoes) { | 	public PotatoPeelingTask(int numPotatoes) { | ||||||
| 		super(numPotatoes * TIME_PER_POTATO); | 		super(numPotatoes * TIME_PER_POTATO); | ||||||
|   | |||||||
| @@ -9,10 +9,10 @@ public abstract class Task { | |||||||
|  |  | ||||||
| 	private static int nextId = 1; | 	private static int nextId = 1; | ||||||
| 	 | 	 | ||||||
| 	private int id; | 	private final int id; | ||||||
| 	private int timeMs; | 	private final int timeMs; | ||||||
| 	 | 	 | ||||||
| 	public Task(int timeMs) { | 	public Task(final int timeMs) { | ||||||
| 		this.id = nextId++; | 		this.id = nextId++; | ||||||
| 		this.timeMs = timeMs; | 		this.timeMs = timeMs; | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -7,9 +7,9 @@ package com.iluwatar; | |||||||
|  */ |  */ | ||||||
| public class Worker implements Runnable { | public class Worker implements Runnable { | ||||||
| 	 | 	 | ||||||
| 	private Task task; | 	private final Task task; | ||||||
|  |  | ||||||
| 	public Worker(Task task) { | 	public Worker(final Task task) { | ||||||
| 		this.task = task; | 		this.task = task; | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user