/** * Get a concatenated String from all elements of the passed array, separated * by the specified separator char. * * @param cSep * The separator to use. * @param aElements * The container to convert. May be <code>null</code> or empty. * @return The concatenated string. * @param <ELEMENTTYPE> * The type of elements to be imploded. */ @Nonnull public static <ELEMENTTYPE> String getImploded (final char cSep, @Nullable final ELEMENTTYPE... aElements) { return getImploded (Character.toString (cSep), aElements); }
/** * Get a concatenated String from all elements of the passed container, * separated by the specified separator char. Even <code>null</code> elements * are added. * * @param cSep * The separator to use. * @param aElements * The container to convert. May be <code>null</code> or empty. * @return The concatenated string. */ @Nonnull public static String getImploded (final char cSep, @Nullable final Iterable <?> aElements) { return getImploded (Character.toString (cSep), aElements); }
@Nonnull public static ESuccess writeFile (@Nonnull final File aFile, @Nonnull final List <String> aContent, @Nonnull final Charset aCharset) { return writeFile (aFile, StringHelper.getImploded (CGlobal.LINE_SEPARATOR, aContent), aCharset); } }
@Nonnull @Deprecated public static ESuccess writeFile (@Nonnull final File aFile, @Nonnull final List <String> aContent, @Nonnull final String sCharset) { return writeFile (aFile, StringHelper.getImploded (CGlobal.LINE_SEPARATOR, aContent), sCharset); }
/** * Get a concatenated String from all elements of the passed map, separated by * the specified separator chars. * * @param cSepOuter * The separator to use for separating the map entries. * @param cSepInner * The separator to use for separating the key from the value. * @param aElements * The map to convert. May be <code>null</code> or empty. * @return The concatenated string. */ @Nonnull public static String getImploded (final char cSepOuter, final char cSepInner, @Nullable final Map <?, ?> aElements) { return getImploded (Character.toString (cSepOuter), Character.toString (cSepInner), aElements); }
/** * Get a concatenated String from all elements of the passed array, separated * by the specified separator char. * * @param cSep * The separator to use. * @param aElements * The container to convert. May be <code>null</code> or empty. * @param nOfs * The offset to start from. * @param nLen * The number of elements to implode. * @return The concatenated string. * @param <ELEMENTTYPE> * The type of elements to be imploded. */ @Nonnull public static <ELEMENTTYPE> String getImploded (final char cSep, @Nullable final ELEMENTTYPE [] aElements, @Nonnegative final int nOfs, @Nonnegative final int nLen) { return getImploded (Character.toString (cSep), aElements, nOfs, nLen); }
/** * Get the passed code list status array as one big string, separated by a * comma. * * @param aStatus * The status array. May not be <code>null</code>. * @return The non-<code>null</code> String of all passed status elements. */ @Nonnull public static String getAsString (@Nonnull final EUNCodelistStatus [] aStatus) { final List <String> ret = new ArrayList <String> (); for (final EUNCodelistStatus eStatus : aStatus) ret.add (eStatus.getID ()); return StringHelper.getImploded (",", ret); } }
/** * Get a concatenated String from all elements of the passed array, without a * separator. * * @param aElements * The container to convert. May be <code>null</code> or empty. * @return The concatenated string. * @param <ELEMENTTYPE> * The type of elements to be imploded. */ @Nonnull public static <ELEMENTTYPE> String getImploded (@Nullable final ELEMENTTYPE... aElements) { if (ArrayHelper.isEmpty (aElements)) return ""; return getImploded (aElements, 0, aElements.length); }
private static String _getWeightInfo (@Nonnull final IGraphRelation aRel, @Nonnull @Nonempty final String sRelationCostAttr) { return "{" + StringHelper.getImploded (',', new TreeSet <String> (aRel.getAllConnectedNodeIDs ())) + ":" + aRel.getAttributeAsInt (sRelationCostAttr) + "}"; }
/** * Get a concatenated String from all elements of the passed array, separated * by the specified separator string. * * @param sSep * The separator to use. May not be <code>null</code>. * @param aElements * The container to convert. May be <code>null</code> or empty. * @return The concatenated string. * @param <ELEMENTTYPE> * The type of elements to be imploded. */ @Nonnull public static <ELEMENTTYPE> String getImploded (@Nonnull final String sSep, @Nullable final ELEMENTTYPE... aElements) { ValueEnforcer.notNull (sSep, "Separator"); if (ArrayHelper.isEmpty (aElements)) return ""; return getImploded (sSep, aElements, 0, aElements.length); }
throw new IllegalStateException (StringHelper.getImploded (aErrors));
s_aLogger.info ("Modified file " + aSrcFile.getName ()); final String sContent = StringHelper.getImploded (CGlobal.LINE_SEPARATOR, aLines) + CGlobal.LINE_SEPARATOR; SimpleFileIO.writeFile (aDstFile, sContent, CCharset.CHARSET_UTF_8_OBJ);
aElements.add (0, PATH_PARENT); return sPrefix + StringHelper.getImploded (UNIX_SEPARATOR_STR, aElements);
@Nonnull public IValidationResult validate (@Nullable final String sValue) { if (m_aPostalCountry == null) { // If no country information is available, it is considered to be valid return ValidationResultSuccess.getInstance (); } if (m_aPostalCountry.isValidPostalCode (sValue)) return ValidationResultSuccess.getInstance (); // Error final String sValidExamples = StringHelper.getImploded (", ", m_aPostalCountry.getAllExamples ()); if (StringHelper.hasText (sValidExamples)) { final Object [] aArgs = { sValidExamples }; return new ValidationResultError (EPostalCodeErrorTexts.INVALID_POSTAL_CODE_WITH_EXAMPLES, aArgs); } return new ValidationResultError (EPostalCodeErrorTexts.INVALID_POSTAL_CODE); }
@Nonnull public IValidationResult validate (@Nullable final String sValue) { if (VATINStructureManager.isValidVATIN (sValue)) return ValidationResultSuccess.getInstance (); final VATINStructure aStructure = VATINStructureManager.getFromVATINCountry (sValue); if (aStructure != null) { final Locale aDisplayLocale = getDisplayLocale (); final String sCountry = aDisplayLocale == null ? aStructure.getCountry ().getDisplayCountry () : aStructure.getCountry ().getDisplayCountry (aDisplayLocale); final String sExamples = StringHelper.getImploded (", ", aStructure.getExamples ()); final Object [] aArgs = { sCountry, sExamples }; return new ValidationResultError (EVATErrorTexts.INVALID_VATIN_WITH_EXAMPLES, aArgs); } return new ValidationResultError (EVATErrorTexts.INVALID_VATIN); } }
for (final IGraphRelation aRel : aSortedRelations) aSortedRelationsText.add (_getWeightInfo (aRel, sRelationCostAttr)); s_aLogger.info ("Sorted relations: " + StringHelper.getImploded (';', aSortedRelationsText));