Given an array like the one below, I was wondering if there is an easy way to turn this array into an array with unique values only?
This is given:
Supposing an array of Objects:
Object[] arr; {...omissis...} List list = new ArrayList(); for(Object val: arr) { if(!list.contains(val)) { list.add(val); } } list.toArray(new Object[0]);
Replace Object with your Array Class if needed.
Object