0
java
hi everyone i have two questions i need your help programmers 1) How to remove duplicates from an array of Integers, without using API methods in Java? 2) Code to implement binary search in Java?
1 Answer
+ 6
1) Do you mean ArrayList<Integer>?
You have to use an iterator to remove the current element. Integer.equals(yourInteger) will test equality. You need a nested loop to test all elements, outer loop iterates the elements and inner loop tests if the current element is equal to another in your list. Would be easier to use a collection that only saves unique elements...