blob: 98385a16c01cb52f2c74eee24570511f0b446948 (
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
26
27
28
|
package space.m0e.quga.oop.lab56maven.entities.common;
import javafx.scene.control.Alert;
import space.m0e.quga.oop.lab56maven.Main;
import space.m0e.quga.oop.lab56maven.dialogs.SortDialog;
import space.m0e.quga.oop.lab56maven.entities.micro.Immigrant;
import java.io.IOException;
import java.util.ArrayList;
import java.util.function.Predicate;
import java.util.stream.Collectors;
public class Utils {
public static void sendErrorAlert(String title, String description) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Error");
alert.setHeaderText(title);
alert.setContentText(description);
alert.showAndWait();
}
public static void findImmigrants(String name, Predicate<? super Immigrant> filterQuery) throws IOException {
ArrayList<Immigrant> sortInput = Main.immigrants.stream().filter(filterQuery).collect(Collectors.toCollection(ArrayList::new));
SortDialog.display(sortInput, name);
}
}
|