@Test public void getText() throws Exception { TranscribeItem item1 = new TranscribeItem(); item1.setText("This"); TranscribeItem item2 = new TranscribeItem(); item2.setText("is"); TranscribeItem item3 = new TranscribeItem(); item3.setText("a"); TranscribeItem item4 = new TranscribeItem(); item4.setText("test"); List<TranscribeItem> items = new ArrayList<>(); items.add(item1); items.add(item2); items.add(item3); items.add(item4); String text = TranscribeUtils.getText(items); assertNotNull(text); assertEquals("This is a test", text); }
public static String getText(List<TranscribeItem> items) { if (items != null && items.size() > 0) { return String.join(" ", items.stream().map(item -> item.getText()).collect(Collectors.toList())); } return null; }
TranscribeUtils { public static String getText(List<TranscribeItem> items) { if (items != null && items.size() > 0) { return String.join(" ", items.stream().map(item -> item.getText()).collect(Collectors.toList())); } return null; } }
TranscribeUtils { public static String getText(List<TranscribeItem> items) { if (items != null && items.size() > 0) { return String.join(" ", items.stream().map(item -> item.getText()).collect(Collectors.toList())); } return null; }  }
TranscribeUtils { public static String getText(List<TranscribeItem> items) { if (items != null && items.size() > 0) { return String.join(" ", items.stream().map(item -> item.getText()).collect(Collectors.toList())); } return null; }  static String getFirstWords(String text, int numberOfWords); static String extractMediaType(String mimeType); static Predicate<T> distinctByProperty(Function<? super T, ?> propertyExtractor); static List<TranscribeItem> clone(List<TranscribeItem> items); static String getText(List<TranscribeItem> items); }
TranscribeUtils { public static String getText(List<TranscribeItem> items) { if (items != null && items.size() > 0) { return String.join(" ", items.stream().map(item -> item.getText()).collect(Collectors.toList())); } return null; }  static String getFirstWords(String text, int numberOfWords); static String extractMediaType(String mimeType); static Predicate<T> distinctByProperty(Function<? super T, ?> propertyExtractor); static List<TranscribeItem> clone(List<TranscribeItem> items); static String getText(List<TranscribeItem> items);  }