code: @SuppressWarnings("unchecked")
      public static <T> Collection<T> flattenCollection(final Collection<? extends Object> source) {
          Validate.notNull(source, "Cannot flatten a null collection.");
  
          final Collection<T> result = new LinkedList<>();
  
          for (final Object value : source) {
              if (value instanceof Collection) {
                  final Collection<Object> flatCollection = flattenCollection((Collection<Object>) value);
                  result.addAll((Collection<T>) flatCollection);
              } else {
                  result.add((T) value);
              }
          }
  
          return result;
      }
docs: Takes a {@link Collection} and creates a flattened {@link Collection} out
  of it.
  
  @param <T> Type of collection (extends Object)
  @param source The {@link Collection} to flatten.
  @return A flattened {@link Collection} that contains all entries from all levels of <code>source</code>.