Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-927

Create Iterable APIs

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • Discussion
    • lang.*
    • None

    Description

      LANG-848 suggests having Iterable APIs in addition to CharSequence... (or potentially other vararg methods).

      Currently we have 10 Iterable APIs:

      ClassUtils.hierarchy(final Class<?> type) {
      ClassUtils.hierarchy(final Class<?> type, Interfaces interfacesBehavior) {
      EnumUtils.generateBitVector(final Class<E> enumClass, final Iterable<E> values) {
      EnumUtils.generateBitVectors(final Class<E> enumClass, final Iterable<E> values) {
      StringUtils.join(final Iterable<?> iterable, final char separator) {
      StringUtils.join(final Iterable<?> iterable, final String separator) {
      StrBuilder.java.StrBuilder appendAll(final Iterable<?> iterable) {
      StrBuilder.appendWithSeparators(final Iterable<?> iterable, String separator) {
      Validate.noNullElements(final T iterable, final String message, final Object... values) {
      Validate.noNullElements(final T iterable) {

      There are many other methods that could have such, but continuing to add Iterable wherever we see varargs is going to bloat the API.

      Perhaps adding a method to ArrayUtils (or IteratorUtils) can suffice:

      public static E[] iteratorToArray(Iterator<E> iterator);

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bayard Henri Yandell
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: