import java.util.Arrays; import java.util.Set; import java.util.stream.Collectors; 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(); } }
- import java.util.Arrays;
import java.util.List;- import java.util.Set;
- import java.util.stream.Collectors;
- 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;
List<Integer> list= Arrays.stream(valuesList).boxed().collect(Collectors.toList());- Set<Integer> list = Arrays.stream(valuesList).boxed().collect(Collectors.toSet());
- return Arrays.stream(integerList).filter(i->!list.contains(i)).toArray();
- }
- }