Removed the "awful" and "shocking" method-which-shall-not-be-named.

This commit is contained in:
Doublestrike
2012-03-02 03:24:39 +00:00
parent c98021a599
commit b61bf22a49

View File

@@ -4,6 +4,7 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -174,7 +175,7 @@ public class ControlConstructed {
/** Generates deck from current list selection(s). */ /** Generates deck from current list selection(s). */
private Deck generateDeck(final JList lst0, final PlayerType player0) { private Deck generateDeck(final JList lst0, final PlayerType player0) {
CardList cards = null; CardList cards = null;
final String[] selection = oa2sa(lst0.getSelectedValues()); final String[] selection = Arrays.copyOf(lst0.getSelectedValues(), lst0.getSelectedValues().length, String[].class);
final Deck deck; final Deck deck;
// Color deck // Color deck
@@ -318,7 +319,7 @@ public class ControlConstructed {
themeNames.add(s); themeNames.add(s);
} }
return oa2sa(themeNames.toArray()); return themeNames.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
} }
private String[] getCustomNames() { private String[] getCustomNames() {
@@ -328,7 +329,7 @@ public class ControlConstructed {
final IStorage<Deck> allDecks = Singletons.getModel().getDecks().getConstructed(); final IStorage<Deck> allDecks = Singletons.getModel().getDecks().getConstructed();
for (final Deck d : allDecks) { customNames.add(d.getName()); } for (final Deck d : allDecks) { customNames.add(d.getName()); }
return oa2sa(customNames.toArray()); return customNames.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
} }
private String[] getEventNames() { private String[] getEventNames() {
@@ -378,21 +379,4 @@ public class ControlConstructed {
} }
return result; return result;
} }
/**
* Exhaustively converts object array to string array.
* Probably a much easier way to do this.
*
* @param o0 &emsp; Object[]
* @return String[]
*/
private String[] oa2sa(final Object[] o0) {
final String[] output = new String[o0.length];
for (int i = 0; i < o0.length; i++) {
output[i] = o0[i].toString();
}
return output;
}
} }