printResult<T> function

void printResult<T>(
  1. List<T> input
)

Helper function to print the result for a list of generic elements.

Implementation

void printResult<T>(List<T> input) {
  final result = firstNonRepeatedElement(input);

  if (result != null) {
    print("First non-repeated element in $input is: '$result'");
  } else {
    print("No non-repeated element found in $input");
  }
}