我需要在Java 8 Map API中替换此函数。
final List<String> x;
x.stream().forEach(id -> isPossibleIdentifier(K, id));
isPossibleIdentifier函数,
public void isPossibleIdentifier(final String name, final String value)
{
isNullOrEmpty(name, value);
if (!value.matches(NUMBER_FORMAT))
{
throw getException(String.format("Invalid format", name));
}
}
此外,我需要专家帮助将其转换为x.strem.map()
要想出主意,我想你需要这样的东西,
x.strem().map(id ->
{
return isPossibleIdentifier(K, id)
};
).forEach(System.out::println);