Merge Names


Java Arrays Public New

Easy 

10min


Implement the uniqueNames method. When passed two arrays of names, it will return an array containing the names that appear in either or both arrays. The returned array should have no duplicates.

For example, calling MergeNames.uniqueNames(new String[]{'Ava', 'Emma', 'Olivia'}, new String[]{'Olivia', 'Sophia', 'Emma'}) should return an array containing Ava, Emma, Olivia, and Sophia in any order.

Java SE 8
   

  •   Example case: java.lang.UnsupportedOperationException at MergeNames.uniqueNames(MergeNames.java:4)
  •   Each array has distinct names: java.lang.UnsupportedOperationException at MergeNames.uniqueNames(MergeNames.java:4)
  •   Each array has duplicate names: java.lang.UnsupportedOperationException at MergeNames.uniqueNames(MergeNames.java:4)
  •   Arrays have some names in common: java.lang.UnsupportedOperationException at MergeNames.uniqueNames(MergeNames.java:4)