@Test public void getSafeValue() { Map<String, String> row = new HashMap<>(); row.put("foo", "123"); assertEquals("123", StringUtils.getSafeValue("foo", row)); assertEquals("", StringUtils.getSafeValue("bar", row)); Map<String, String> row2 = new HashMap<>(); row2.put("bar", "true"); List<Map<String, String>> rows = new ArrayList<>(); rows.add(row); rows.add(row2); assertEquals("123", StringUtils.getSafeValue("foo", rows)); assertEquals("true", StringUtils.getSafeValue("bar", rows)); assertEquals("", StringUtils.getSafeValue("baz", rows)); }
@NotNull public static String getSafeValue(String key, List<Map<String, String>> rows) { for (Map<String, String> row : rows) { String value = row.get(key); if (value != null) { return value; } } return ""; }
StringUtils { @NotNull public static String getSafeValue(String key, List<Map<String, String>> rows) { for (Map<String, String> row : rows) { String value = row.get(key); if (value != null) { return value; } } return ""; } }
StringUtils { @NotNull public static String getSafeValue(String key, List<Map<String, String>> rows) { for (Map<String, String> row : rows) { String value = row.get(key); if (value != null) { return value; } } return ""; } private  StringUtils(); }
StringUtils { @NotNull public static String getSafeValue(String key, List<Map<String, String>> rows) { for (Map<String, String> row : rows) { String value = row.get(key); if (value != null) { return value; } } return ""; } private  StringUtils(); @Nullable static String asComponentName(String val); @Nullable static String asLanguageName(String val); @NotNull static String getSafeValue(String key, List<Map<String, String>> rows); @NotNull static String getSafeValue(String key, Map<String, String> rows); @NotNull static String wrapSeparator(String line, String separator, String newLine, int watermark); @Nullable static String wrapWords(String line, String newLine, int watermark, boolean wrapLongWords); static boolean isEmpty(String str); static boolean isNotEmpty(String str); static String stripDoubleQuotes(String text); }
StringUtils { @NotNull public static String getSafeValue(String key, List<Map<String, String>> rows) { for (Map<String, String> row : rows) { String value = row.get(key); if (value != null) { return value; } } return ""; } private  StringUtils(); @Nullable static String asComponentName(String val); @Nullable static String asLanguageName(String val); @NotNull static String getSafeValue(String key, List<Map<String, String>> rows); @NotNull static String getSafeValue(String key, Map<String, String> rows); @NotNull static String wrapSeparator(String line, String separator, String newLine, int watermark); @Nullable static String wrapWords(String line, String newLine, int watermark, boolean wrapLongWords); static boolean isEmpty(String str); static boolean isNotEmpty(String str); static String stripDoubleQuotes(String text);  }