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 90be85907b17d17340d6e87cff5670ffb210fc08..78586100752e4f36ad0f6e52abd2788669568980 100644 --- a/common/source/java/ch/systemsx/cisd/common/collections/CollectionUtils.java +++ b/common/source/java/ch/systemsx/cisd/common/collections/CollectionUtils.java @@ -91,6 +91,21 @@ public final class CollectionUtils return abbreviate(collection, maxLength, ToStringDefaultConverter.getInstance(), style); } + /** + * Abbreviates a given <code>Collection</code>. + * <p> + * By default it shows the number of items left. + * </p> + * + * @param maxLength the maximum number of items that should be shown. If <code>-1</code> then all items will be + * displayed. + */ + public final static <T> String abbreviate(final Collection<T> collection, final int maxLength, + final IToStringConverter<? super T> converter) + { + return abbreviate(collection, maxLength, converter, CollectionStyle.DEFAULT_COLLECTION_STYLE); + } + /** * Abbreviates a given <code>Collection</code>. * <p>