Codility - OddOccurrencesInArray

RESULT

import java.util.*;

class Solution {
    public int solution(int[] A) {
        Set<Integer> set = new HashSet<>();
        for (int a : A) {
            if (set.contains(a)) {
                set.remove(a);
            } else {
                set.add(a);
            }
        }
        
        return (int) set.toArray()[0];
    }
}