INNER CODE UNIT · Java
safe
SeaseLtd/rated-ranking-evaluator · rre-core/src/main/java/io/sease/rre/Func.java:66
public static <T> List<T> safe(final List<T> values) {
return values != null ? values : emptyList();
}
/**
* Converts the content of the given file to a JSON node.
*
* @param file the input file.
* @return a {@link JsonNode} instance representing the file content.
*/
public static JsonNode toJson(final File file) {
final ObjectMapper mapper = new ObjectMapper();
try {
return mapper.readTree(file);
} catch (final IOException exception) {
throw new IllegalArgumentException(file.getAbsolutePath(), exception);
}
}