Ad
Code
Diff
  • import java.util.Arrays;
    import java.util.Set;
    import java.util.stream.Collectors;
    import java.util.Optional;
    import java.util.List;
    
    public class Kata
    {
    public static int[] Remove(int[] integerList,int[] valuesList)
        {
            final List<Integer> values = Arrays.stream(Optional.ofNullable(valuesList).orElse(new int[]{})).boxed().collect(Collectors.toList());
            return Arrays.stream(Optional.ofNullable(integerList).orElse(new int[]{})).filter(o -> !values.contains(o)).toArray();
        }
    }
    • import java.util.Arrays;
    • import java.util.Set;
    • import java.util.stream.Collectors;
    • import java.util.Optional;
    • import java.util.List;
    • public class Kata
    • {
    • public static int[] Remove(int[] integerList,int[] valuesList)
    • {
    • if (integerList==null||integerList.length<1) return new int[0];
    • if (valuesList==null||valuesList.length<1) return integerList;
    • Set<Integer> list = Arrays.stream(valuesList).boxed().collect(Collectors.toSet());
    • return Arrays.stream(integerList).filter(i->!list.contains(i)).toArray();
    • }
    • {
    • final List<Integer> values = Arrays.stream(Optional.ofNullable(valuesList).orElse(new int[]{})).boxed().collect(Collectors.toList());
    • return Arrays.stream(Optional.ofNullable(integerList).orElse(new int[]{})).filter(o -> !values.contains(o)).toArray();
    • }
    • }