code: public static <T, E extends Exception> List<T> distinctBy(final T[] a, final int fromIndex, final int toIndex,
              final Try.Function<? super T, ?, E> keyMapper) throws E {
          checkFromToIndex(fromIndex, toIndex, len(a));
  
          if (N.isNullOrEmpty(a)) {
              return new ArrayList<>();
          }
  
          final List<T> result = new ArrayList<>();
          final Set<Object> set = new HashSet<>();
  
          for (int i = fromIndex; i < toIndex; i++) {
              if (set.add(hashKey(keyMapper.apply(a[i])))) {
                  result.add(a[i]);
              }
          }
  
          return result;
      }
docs: Distinct by the value mapped from <code>keyMapper</code>.
  
  Mostly it's designed for one-step operation to complete the operation in one step.
  <code>java.util.stream.Stream</code> is preferred for multiple phases operation.
  
  @param a
  @param fromIndex
  @param toIndex
  @param keyMapper don't change value of the input parameter.
  @return