Skip to content

Instantly share code, notes, and snippets.

@mclosson
Created May 20, 2016 04:53
Show Gist options
  • Save mclosson/0075b948bcf650c45db36f40d871307a to your computer and use it in GitHub Desktop.
Save mclosson/0075b948bcf650c45db36f40d871307a to your computer and use it in GitHub Desktop.
import java.util.*;
public class Set {
private List values = new ArrayList();
public Set(int[] inputSet) {
for (int i = 0; i < inputSet.length; i++) {
boolean exists = values.contains(inputSet[i]);
if (!exists) {
this.values.add(inputSet[i]);
}
}
}
public void output() {
for (int i = 0; i < values.size(); i++) {
System.out.println(values.get(i).toString());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment