Created
May 20, 2016 04:53
-
-
Save mclosson/0075b948bcf650c45db36f40d871307a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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