Created
July 9, 2023 14:59
-
-
Save isicju/54060ff9468f865211f78beaa777abb4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String[] args) throws InterruptedException { | |
System.out.println("Works"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
public static Map<String, User> findLowIncomeCitizens(ArrayList users) {
return users.stream()
.filter(user -> user.getCity().equals("New York") && user.getSalary() < 100L)
.collect(Collectors.toMap(User::getGuid, Function.identity()));
}
public static Country findCountryByName(DataSource dataSource, String countryName) throws SQLException {
try (Connection connection = dataSource.getConnection();
PreparedStatement statement = connection.prepareStatement("SELECT * FROM countries WHERE name = ?")) {
statement.setString(1, countryName);
try (ResultSet resultSet = statement.executeQuery()) {
if (resultSet.next()) {
return new Country(countryName, resultSet.getString("region"));
}
}
} catch (SQLException e) {
return null;
}
return null;
}