From f417807cb5a9bad1787654f7cd504bc48686ff24 Mon Sep 17 00:00:00 2001 From: ribeaudc <ribeaudc> Date: Fri, 11 Apr 2008 18:39:13 +0000 Subject: [PATCH] change: - Small 'PropertyRelationTableModel' refactoring. SVN: 5476 --- .../common/collections/CollectionUtils.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/common/source/java/ch/systemsx/cisd/common/collections/CollectionUtils.java b/common/source/java/ch/systemsx/cisd/common/collections/CollectionUtils.java index fd9b3cfcd51..1d627dcc727 100644 --- a/common/source/java/ch/systemsx/cisd/common/collections/CollectionUtils.java +++ b/common/source/java/ch/systemsx/cisd/common/collections/CollectionUtils.java @@ -223,6 +223,25 @@ public final class CollectionUtils return abbreviate(Arrays.asList(objects), maxLength, showLeft, converter, style); } + /** + * Abbreviates a given array of <code>Object</code>. + * + * <pre> + * CollectionUtils.abbreviate(new String[] { "1", "2", "3", "4", "5" }, 3, false) = "[1, 2, 3, ...]" + * CollectionUtils.abbreviate(new String[] { "1", "2", "3", "4", "5" }, 3, true) = "[1, 2, 3, ... (2 left)]" + * </pre> + * + * @param maxLength the maximum number of items that should be shown. If <code>-1</code> then + * all items will be displayed. + * @param style the style that should be applied to the output. + */ + public final static <T> String abbreviate(final T[] objects, final int maxLength, + final IToStringConverter<? super T> converter, final CollectionStyle style) + { + assert objects != null : "Given objects can not be null."; + return abbreviate(Arrays.asList(objects), maxLength, true, converter, style); + } + /** * Abbreviates a given <code>Collection</code>. * -- GitLab