blob: 232d1a8f5a1b116dc761de127ed92bf685a699a5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package com.it_jaros.jscanner;
import java.util.ArrayList;
import java.util.List;
public class ScanState {
private final List<ScanResult> scanResult;
public ScanState() {
// scanResult can not be given from outside because this class controls full access to it
this.scanResult = new ArrayList<>();
}
public void addScanResult(ScanResult newResult) {
synchronized (this.scanResult) {
this.scanResult.add(newResult);
}
}
public List<ScanResult> getCopyOfResults() {
synchronized (scanResult) {
return List.copyOf(scanResult);
}
}
}
|