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 filterQuery) throws IOException { ArrayList sortInput = Main.immigrants.stream().filter(filterQuery).collect(Collectors.toCollection(ArrayList::new)); SortDialog.display(sortInput, name); } }