IdentifiableObjectUtils { public static String join( Collection<? extends IdentifiableObject> objects ) { if ( objects == null || objects.isEmpty() ) { return null; } List<String> names = objects.stream().map( IdentifiableObject::getDisplayName ).collect( Collectors.toList() ); return StringUtils.join( names, SEPARATOR_JOIN ); }  static String join( Collection<? extends IdentifiableObject> objects ); static List<String> getUids( Collection<T> objects ); static List<String> getCodes( Collection<T> objects ); static List<Long> getIdentifiers( Collection<T> objects ); static Map<Long, T> getIdentifierMap( Collection<T> objects ); static List<String> getLocalPeriodIdentifiers( Collection<T> periods, Calendar calendar ); static String getLocalPeriodIdentifier( Period period, Calendar calendar ); static Period getPeriodByPeriodType( Period period, PeriodType periodType, Calendar calendar ); static List<T> filterNameByKey( List<T> identifiableObjects, String key,
        boolean ignoreCase ); static List<T> removeDuplicates( List<T> list ); static String getLastUpdatedTag( Collection<T> objects ); static String getLastUpdatedTag( IdentifiableObject object ); static Map<String, String> getUidNameMap( Collection<? extends IdentifiableObject> objects ); static Map<String, String> getUidPropertyMap( Collection<? extends IdentifiableObject> objects, IdentifiableProperty property ); static Map<String, T> getUidObjectMap( Collection<T> objects ); static Map<String, T> getIdMap( List<T> objects, IdScheme idScheme ); static String getDisplayName( Object object ); static String getIdentifierBasedOnIdScheme( T object, IdScheme idScheme ); static final String SEPARATOR; static final String SEPARATOR_JOIN; static final DateTimeFormatter LONG_DATE_FORMAT; static final DateTimeFormatter MEDIUM_DATE_FORMAT; static final Map<String, String> CLASS_ALIAS; }
@Test public void testJoin() { DataElement deA = new DataElement( "DEA" ); DataElement deB = new DataElement( "DEB" ); DataElement deC = new DataElement( "DEC" ); String expected = deA.getDisplayName() + SEPARATOR_JOIN + deB.getDisplayName() + SEPARATOR_JOIN + deC.getDisplayName(); assertEquals( expected, IdentifiableObjectUtils.join( Lists.newArrayList( deA, deB, deC ) ) ); assertNull( IdentifiableObjectUtils.join( null ) ); assertNull( IdentifiableObjectUtils.join( Lists.newArrayList() ) ); }