Skip to content

Instantly share code, notes, and snippets.

Created April 27, 2013 13:49
Show Gist options
  • Save anonymous/5473192 to your computer and use it in GitHub Desktop.
Save anonymous/5473192 to your computer and use it in GitHub Desktop.
package Roulette;
import java.text.MessageFormat;
import java.util.Collection;
import java.util.Set;
import java.util.Iterator;
import java.util.TreeSet;
public class Bin{
public TreeSet<Outcome> outcomes;
int i =0;
Bin(){
outcomes = new TreeSet<Outcome>();
}
Bin(Outcome[] outcomes){
this();
for(Outcome anOutcome: outcomes){
add(anOutcome);
}
}
Bin(Collection<Outcome> outcomes){
this();
for(Outcome anOutcome: outcomes){
add(anOutcome);
}
}
void add(Outcome outcome){
this.outcomes.add(outcome);
}
// public String toString() {
// Object[] values= { this.outcomes.toString() };
// String msgTempl= "{0}";
// return MessageFormat.format( msgTempl, values );
// }
public String toString(){
String string ="";
Iterator it1 =this.outcomes.iterator();
while(it1.hasNext()){
string += "["+it1.next().toString()+"]";
}
return string;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment