Uploaded image for project: 'Edgent'
  1. Edgent
  2. EDGENT-47

Remove unnecessary null check in ConnectorStream.split(enumClass, splitter)

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • None
    • None
    • None

    Description

      There are unnecessary null check in split method of ConnectorStream.java

      I thought there are posibillity to return a null in getEnumConstants() so created null check logic.

      ConnectorStream.java
      public <E extends Enum<E>> EnumMap<E,TStream<T>> split(Class<E> enumClass, Function<T, E> splitter) {
      
              E[] es = enumClass.getEnumConstants();
              if(es == null) {
                  throw new IllegalArgumentException("Class object does not represent an enum type");
              }
      

      But the argument defined that enumClass is alway enum<E>. It's my mistake. The null checker is not necessary.

      It's simple change but create a jira issue because I believe it is important to leave a record of the changes and mapping 1-1(or 1-N) to github PR.

      Attachments

        Issue Links

          Activity

            People

              cazen Cazen Lee
              cazen Cazen Lee
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: