Merge branch 'master' into 'start_trigger_run_params_refactor'

# Conflicts:
#   forge-gui-desktop/src/test/java/forge/gamesimulationtests/util/GameWrapper.java
This commit is contained in:
Ryan Wiedemann
2019-09-07 23:36:05 +00:00
881 changed files with 4590 additions and 4753 deletions

View File

@@ -61,7 +61,7 @@ import java.util.concurrent.TimeUnit;
public class ImageCache {
// short prefixes to save memory
private static final Set<String> _missingIconKeys = new HashSet<String>();
private static final Set<String> _missingIconKeys = new HashSet<>();
private static final LoadingCache<String, BufferedImage> _CACHE = CacheBuilder.newBuilder()
.maximumSize(FModel.getPreferences().getPrefInt((FPref.UI_IMAGE_CACHE_MAXIMUM)))
.expireAfterAccess(15, TimeUnit.MINUTES)

View File

@@ -52,7 +52,7 @@ public class KeyboardShortcuts {
final InputMap im = c.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
final ActionMap am = c.getActionMap();
final List<Shortcut> list = new ArrayList<Shortcut>();
final List<Shortcut> list = new ArrayList<>();
//========== Match Shortcuts
/** Show stack. */
@@ -345,9 +345,9 @@ public class KeyboardShortcuts {
List<String> existingCodes;
if (codestring != null) {
existingCodes = new ArrayList<String>(Arrays.asList(codestring.split(" ")));
existingCodes = new ArrayList<>(Arrays.asList(codestring.split(" ")));
} else {
existingCodes = new ArrayList<String>();
existingCodes = new ArrayList<>();
}
// Backspace (8) will remove last code from list.

View File

@@ -27,9 +27,9 @@ public class DecksComboBox extends FComboBoxWrapper<DeckType> {
public void refresh(final DeckType deckType, final boolean isForCommander) {
if(isForCommander){
setModel(new DefaultComboBoxModel<DeckType>(DeckType.CommanderOptions));
setModel(new DefaultComboBoxModel<>(DeckType.CommanderOptions));
}else {
setModel(new DefaultComboBoxModel<DeckType>(DeckType.ConstructedOptions));
setModel(new DefaultComboBoxModel<>(DeckType.ConstructedOptions));
}
setSelectedItem(deckType);
}

View File

@@ -444,7 +444,7 @@ public class FDeckChooser extends JPanel implements IDecksComboBoxListener {
if (decksComboBox.getDeckType() == null || decksComboBox.getDeckType() == DeckType.NET_DECK) {
//handle special case of net decks
if (netDeckCategory == null) { return ""; }
state.append(NetDeckCategory.PREFIX + netDeckCategory.getName());
state.append(NetDeckCategory.PREFIX).append(netDeckCategory.getName());
}
else {
state.append(decksComboBox.getDeckType().name());
@@ -506,13 +506,13 @@ public class FDeckChooser extends JPanel implements IDecksComboBoxListener {
private List<String> getSelectedDecksFromSavedState(final String savedState) {
try {
if (StringUtils.isBlank(savedState)) {
return new ArrayList<String>();
return new ArrayList<>();
} else {
return Arrays.asList(savedState.split(";")[1].split(SELECTED_DECK_DELIMITER));
}
} catch (final Exception ex) {
System.err.println(ex + " [savedState=" + savedState + "]");
return new ArrayList<String>();
return new ArrayList<>();
}
}

View File

@@ -36,7 +36,7 @@ import java.util.TreeMap;
@SuppressWarnings("serial")
public class FDeckViewer extends FDialog {
private final Deck deck;
private final List<DeckSection> sections = new ArrayList<DeckSection>();
private final List<DeckSection> sections = new ArrayList<>();
private final CardManager cardManager;
private DeckSection currentSection;

View File

@@ -67,7 +67,7 @@ public class BugReportDialog {
// Button is not modified, String gets the automatic listener to hide
// the dialog
List<Object> options = new ArrayList<Object>();
List<Object> options = new ArrayList<>();
options.add(new JButton(new _Report()));
// option to enable automatic Sentry submission
options.add(new JCheckBox(new _ActivateSentry()));

View File

@@ -100,7 +100,7 @@ public class BoxedProductCardListViewer extends FDialog {
*/
public BoxedProductCardListViewer(final String title, final String message, final List<PaperCard> list, final Icon dialogIcon) {
this.list = Collections.unmodifiableList(list);
this.jList = new JList<PaperCard>(new ChooserListModel());
this.jList = new JList<>(new ChooserListModel());
this.detail = new CardDetailPanel();
this.picture = new CardPicturePanel();
this.picture.setOpaque(false);

View File

@@ -98,7 +98,7 @@ public class CardListViewer extends FDialog {
*/
public CardListViewer(final String title, final String message, final List<PaperCard> list, final Icon dialogIcon) {
this.list = Collections.unmodifiableList(list);
this.jList = new JList<PaperCard>(new ChooserListModel());
this.jList = new JList<>(new ChooserListModel());
this.detail = new CardDetailPanel();
this.picture = new CardPicturePanel();
this.picture.setOpaque(false);

View File

@@ -79,10 +79,10 @@ public class DualListBox<T> extends FDialog {
targetRemainingSourcesMin = remainingSourcesMin;
targetRemainingSourcesMax = remainingSourcesMax;
sourceListModel = new UnsortedListModel<T>();
sourceList = new FList<T>(sourceListModel);
destListModel = new UnsortedListModel<T>();
destList = new FList<T>(destListModel);
sourceListModel = new UnsortedListModel<>();
sourceList = new FList<>(sourceListModel);
destListModel = new UnsortedListModel<>();
destList = new FList<>(destListModel);
final Runnable onAdd = new Runnable() {
@SuppressWarnings("unchecked")
@@ -90,7 +90,7 @@ public class DualListBox<T> extends FDialog {
public void run() {
if (!addButton.isEnabled()) { return; }
List<T> selected = new ArrayList<T>();
List<T> selected = new ArrayList<>();
for (Object item : sourceList.getSelectedValuesList()) {
selected.add((T)item);
}
@@ -107,7 +107,7 @@ public class DualListBox<T> extends FDialog {
public void run() {
if (!removeButton.isEnabled()) { return; }
List<T> selected = new ArrayList<T>();
List<T> selected = new ArrayList<>();
for (Object item : destList.getSelectedValuesList()) {
selected.add((T)item);
}

View File

@@ -89,7 +89,7 @@ public class GuiChoose {
return getInteger(message, min, max);
}
final List<Object> choices = new ArrayList<Object>();
final List<Object> choices = new ArrayList<>();
for (int i = min; i <= cutoff; i++) {
choices.add(Integer.valueOf(i));
}
@@ -143,7 +143,7 @@ public class GuiChoose {
public static <T> List<T> getChoices(final String message, final int min, final int max, final Collection<T> choices, final T selected, final Function<T, String> display, final CMatchUI matchUI) {
if (choices == null || choices.isEmpty()) {
if (min == 0) {
return new ArrayList<T>();
return new ArrayList<>();
}
throw new RuntimeException("choice required from empty list");
}
@@ -151,7 +151,7 @@ public class GuiChoose {
final Callable<List<T>> showChoice = new Callable<List<T>>() {
@Override
public List<T> call() {
final ListChooser<T> c = new ListChooser<T>(message, min, max, choices, display);
final ListChooser<T> c = new ListChooser<>(message, min, max, choices, display);
final JList<T> list = c.getLstChoices();
if (matchUI != null) {
list.addListSelectionListener(new ListSelectionListener() {
@@ -224,7 +224,7 @@ public class GuiChoose {
}
};
final FutureTask<List<T>> future = new FutureTask<List<T>>(showChoice);
final FutureTask<List<T>> future = new FutureTask<>(showChoice);
FThreads.invokeInEdtAndWait(future);
try {
return future.get();
@@ -251,7 +251,7 @@ public class GuiChoose {
final Callable<List<T>> callable = new Callable<List<T>>() {
@Override
public List<T> call() {
final DualListBox<T> dual = new DualListBox<T>(remainingObjectsMin, remainingObjectsMax, sourceChoices, destChoices, matchUI);
final DualListBox<T> dual = new DualListBox<>(remainingObjectsMin, remainingObjectsMax, sourceChoices, destChoices, matchUI);
dual.setSecondColumnLabelText(top);
dual.setSideboardMode(sideboardingMode);
@@ -275,7 +275,7 @@ public class GuiChoose {
}
};
final FutureTask<List<T>> ft = new FutureTask<List<T>>(callable);
final FutureTask<List<T>> ft = new FutureTask<>(callable);
FThreads.invokeInEdtAndWait(ft);
try {
return ft.get();
@@ -298,7 +298,7 @@ public class GuiChoose {
return cardList;
}
};
final FutureTask<List<CardView>> ft = new FutureTask<List<CardView>>(callable);
final FutureTask<List<CardView>> ft = new FutureTask<>(callable);
FThreads.invokeInEdtAndWait(ft);
gui.clearSelectables();
try {

View File

@@ -35,7 +35,7 @@ public class GuiDialog {
return Boolean.valueOf(answer == 0);
}};
final FutureTask<Boolean> future = new FutureTask<Boolean>(confirmTask);
final FutureTask<Boolean> future = new FutureTask<>(confirmTask);
FThreads.invokeInEdtAndWait(future);
try {
return future.get().booleanValue();

View File

@@ -313,7 +313,7 @@ public class ImportDialog {
// associates a file operation type with its enablement checkbox and the set
// of file move/copy operations that enabling it would entail
private final Map<OpType, Pair<FCheckBox, ? extends Map<File, File>>> _selections =
new HashMap<OpType, Pair<FCheckBox, ? extends Map<File, File>>>();
new HashMap<>();
// attached to all changeable widgets to keep the UI in sync
private final ChangeListener _stateChangedListener = new ChangeListener() {
@@ -359,7 +359,7 @@ public class ImportDialog {
_addSelectionWidget(knownDeckPanel, OpType.UNKNOWN_DECK, "Unknown decks");
final JPanel unknownDeckPanel = new JPanel(new MigLayout("insets 0, gap 5"));
unknownDeckPanel.setOpaque(false);
_unknownDeckCombo = new FComboBoxWrapper<_UnknownDeckChoice>();
_unknownDeckCombo = new FComboBoxWrapper<>();
_unknownDeckCombo.addItem(new _UnknownDeckChoice("Constructed", ForgeConstants.DECK_CONSTRUCTED_DIR));
_unknownDeckCombo.addItem(new _UnknownDeckChoice("Draft", ForgeConstants.DECK_DRAFT_DIR));
_unknownDeckCombo.addItem(new _UnknownDeckChoice("Planar", ForgeConstants.DECK_PLANE_DIR));
@@ -464,14 +464,14 @@ public class ImportDialog {
// use a skip list map instead of a regular hashmap so that the files are sorted
// alphabetically in the logs. note that this is a concurrent data structure
// since it will be modified and read simultaneously by different threads
_selections.put(type, Pair.of(cb, new ConcurrentSkipListMap<File, File>()));
_selections.put(type, Pair.of(cb, new ConcurrentSkipListMap<>()));
parent.add(cb, constraints);
}
// must be called from GUI event loop thread
private void _updateUI() {
// update checkbox text labels with current totals
final Set<OpType> selectedOptions = new HashSet<OpType>();
final Set<OpType> selectedOptions = new HashSet<>();
for (final Map.Entry<OpType, Pair<FCheckBox, ? extends Map<File, File>>> entry : _selections.entrySet()) {
final Pair<FCheckBox, ? extends Map<File, File>> selection = entry.getValue();
final FCheckBox cb = selection.getLeft();
@@ -494,7 +494,7 @@ public class ImportDialog {
Timer timer = null;
try {
final Map<OpType, Map<File, File>> selections = new HashMap<OpType, Map<File, File>>();
final Map<OpType, Map<File, File>> selections = new HashMap<>();
for (final Map.Entry<OpType, Pair<FCheckBox, ? extends Map<File, File>>> entry : _selections.entrySet()) {
selections.put(entry.getKey(), entry.getValue().getRight());
}
@@ -607,7 +607,7 @@ public class ImportDialog {
// user an option to fix
if (_isMigration) {
// assemble a list of selections that need to be selected to complete a full migration
final List<String> unselectedButShouldBe = new ArrayList<String>();
final List<String> unselectedButShouldBe = new ArrayList<>();
for (final Map.Entry<OpType, Pair<FCheckBox, ? extends Map<File, File>>> entry : _selections.entrySet()) {
if (OpType.POSSIBLE_SET_CARD_PIC == entry.getKey()) {
continue;
@@ -709,7 +709,7 @@ public class ImportDialog {
super("OperationLogUpdater");
setDaemon(true);
_selections = new HashMap<OpType, Map<File, File>>();
_selections = new HashMap<>();
_operationLog = operationLog;
// remove references to FCheckBox when populating map -- we can't safely access it from a thread
@@ -844,7 +844,7 @@ public class ImportDialog {
// build local operations map that only includes data that we can access from the background thread
// use a tree map to maintain alphabetical order
_operations = new TreeMap<File, File>();
_operations = new TreeMap<>();
for (final Map.Entry<OpType, Pair<FCheckBox, ? extends Map<File, File>>> entry : selections.entrySet()) {
final Pair<FCheckBox, ? extends Map<File, File>> selection = entry.getValue();
if (selection.getLeft().isSelected()) {

View File

@@ -87,7 +87,7 @@ public class ListChooser<T> {
this.minChoices = minChoices;
this.maxChoices = maxChoices;
this.list = list.getClass().isInstance(List.class) ? (List<T>)list : Lists.newArrayList(list);
this.lstChoices = new FList<T>(new ChooserListModel());
this.lstChoices = new FList<>(new ChooserListModel());
final ImmutableList<String> options;
if (minChoices == 0) {

View File

@@ -517,7 +517,7 @@ public class MultiLineLabelUI extends BasicLabelUI implements ComponentListener
* @return a list of text lines to render
*/
protected List<String> prepareLines(final JLabel l) {
final List<String> lines = new ArrayList<String>(MultiLineLabelUI.defaultSize);
final List<String> lines = new ArrayList<>(MultiLineLabelUI.defaultSize);
final String text = l.getText();
if (text == null) {
return null; // Null guard
@@ -603,7 +603,7 @@ public class MultiLineLabelUI extends BasicLabelUI implements ComponentListener
/**
* Reused segments.
*/
private final List<Segment> segments = new ArrayList<Segment>(2);
private final List<Segment> segments = new ArrayList<>(2);
/**
* Singleton instance.

View File

@@ -44,7 +44,7 @@ public class UnsortedListModel<T> extends AbstractListModel<T> {
}
public void addAll(final ListModel<T> otherModel) {
final Collection<T> elements = new ArrayList<T>();
final Collection<T> elements = new ArrayList<>();
final int size = otherModel.getSize();
for (int i = 0; size > i; ++i) {
elements.add(otherModel.getElementAt(i));

View File

@@ -50,7 +50,7 @@ public final class DragCell extends JPanel implements ILocalRepaint {
private final int margin = 2 * tabPaddingPx;
// Tab handling layout stuff
private final List<IVDoc<? extends ICDoc>> allDocs = new ArrayList<IVDoc<? extends ICDoc>>();
private final List<IVDoc<? extends ICDoc>> allDocs = new ArrayList<>();
private final JLabel lblHandle = new DragHandle();
private final JLabel lblOverflow = new JLabel();
private IVDoc<? extends ICDoc> docSelected = null;
@@ -355,7 +355,7 @@ public final class DragCell extends JPanel implements ILocalRepaint {
if (allDocs.isEmpty()) { return; }
// Order tabs by priority
final List<DragTab> priority = new ArrayList<DragTab>();
final List<DragTab> priority = new ArrayList<>();
final DragTab selectedTab = docSelected.getTabLabel();
DragTab nextTab = selectedTab;

View File

@@ -556,7 +556,7 @@ public final class SLayoutIO {
EDocID selectedId = null;
double x0 = 0, y0 = 0, w0 = 0, h0 = 0;
MapOfLists<LayoutInfo, EDocID> model = new HashMapOfLists<LayoutInfo, EDocID>(CollectionSuppliers.arrayLists());
MapOfLists<LayoutInfo, EDocID> model = new HashMapOfLists<>(CollectionSuppliers.arrayLists());
LayoutInfo currentKey = null;
while (null != reader && reader.hasNext()) {

View File

@@ -45,7 +45,7 @@ public final class SRearrangingUtil {
private static DragCell cellSrc = null;
private static DragCell cellNew = null;
private static Dropzone dropzone = Dropzone.NONE;
private static List<IVDoc<? extends ICDoc>> docsToMove = new ArrayList<IVDoc<? extends ICDoc>>();
private static List<IVDoc<? extends ICDoc>> docsToMove = new ArrayList<>();
private static IVDoc<? extends ICDoc> srcSelectedDoc = null;
private static final SkinCursor CUR_L = FSkin.getCursor(FSkinProp.IMG_CUR_L, 16, 16, "CUR_L");
@@ -98,9 +98,7 @@ public final class SRearrangingUtil {
}
// Otherwise, add all of the documents.
else {
for (final IVDoc<? extends ICDoc> vDoc : cellSrc.getDocs()) {
docsToMove.add(vDoc);
}
docsToMove.addAll(cellSrc.getDocs());
}
// Reset and show preview panel
@@ -312,7 +310,7 @@ public final class SRearrangingUtil {
* from any side which shares corners with the gap. */
private static void fillGap() {
// Variables to help with matching the borders
final List<DragCell> cellsToResize = new ArrayList<DragCell>();
final List<DragCell> cellsToResize = new ArrayList<>();
final int srcX = cellSrc.getAbsX();
final int srcX2 = cellSrc.getAbsX2();
final int srcY = cellSrc.getAbsY();

View File

@@ -22,10 +22,10 @@ import java.util.List;
* <br><br><i>(S at beginning of class name denotes a static factory.)</i>
*/
public final class SResizingUtil {
private static final List<DragCell> LEFT_PANELS = new ArrayList<DragCell>();
private static final List<DragCell> RIGHT_PANELS = new ArrayList<DragCell>();
private static final List<DragCell> TOP_PANELS = new ArrayList<DragCell>();
private static final List<DragCell> BOTTOM_PANELS = new ArrayList<DragCell>();
private static final List<DragCell> LEFT_PANELS = new ArrayList<>();
private static final List<DragCell> RIGHT_PANELS = new ArrayList<>();
private static final List<DragCell> TOP_PANELS = new ArrayList<>();
private static final List<DragCell> BOTTOM_PANELS = new ArrayList<>();
private static int dX;
private static int evtX;
@@ -135,10 +135,8 @@ public final class SResizingUtil {
double roughVal = 0;
int smoothVal = 0;
Set<Component> existingComponents = new HashSet<Component>();
for (Component c : pnlContent.getComponents()) {
existingComponents.add(c);
}
Set<Component> existingComponents = new HashSet<>();
existingComponents.addAll(Arrays.asList(pnlContent.getComponents()));
// This is the core of the pixel-perfect layout. To avoid ±1 px errors on borders
// from rounding individual panels, the intermediate values (exactly accurate, in %)

View File

@@ -49,7 +49,7 @@ public class CardManager extends ItemManager<PaperCard> {
@Override
protected Iterable<Entry<PaperCard, Integer>> getUnique(Iterable<Entry<PaperCard, Integer>> items) {
//use special technique for getting unique cards so that cards without art aren't shown
HashMap<String, Entry<PaperCard, Integer>> map = new HashMap<String, Entry<PaperCard, Integer>>();
HashMap<String, Entry<PaperCard, Integer>> map = new HashMap<>();
for (Entry<PaperCard, Integer> item : items) {
final String key = item.getKey().getName();
final Entry<PaperCard, Integer> oldValue = map.get(key);
@@ -218,7 +218,7 @@ public class CardManager extends ItemManager<PaperCard> {
filter.edit();
}
else {
filter = new AdvancedSearchFilter<PaperCard>(itemManager);
filter = new AdvancedSearchFilter<>(itemManager);
itemManager.lockFiltering = true; //ensure filter not applied until added
boolean result = filter.edit();
itemManager.lockFiltering = false;

View File

@@ -108,7 +108,7 @@ public final class DeckManager extends ItemManager<DeckProxy> implements IHasGam
if (config0.getCols().containsKey(ColumnDef.DECK_ACTIONS)) {
final ItemTableColumn column = new ItemTableColumn(new ItemColumn(config0.getCols().get(ColumnDef.DECK_ACTIONS)));
column.setCellRenderer(new DeckActionsRenderer());
colOverrides = new HashMap<ColumnDef, ItemTableColumn>();
colOverrides = new HashMap<>();
colOverrides.put(ColumnDef.DECK_ACTIONS, column);
}
super.setup(config0, colOverrides);
@@ -307,7 +307,7 @@ public final class DeckManager extends ItemManager<DeckProxy> implements IHasGam
filter.edit();
}
else {
filter = new AdvancedSearchFilter<DeckProxy>(DeckManager.this);
filter = new AdvancedSearchFilter<>(DeckManager.this);
lockFiltering = true; //ensure filter not applied until added
boolean result = filter.edit();
lockFiltering = false;

View File

@@ -77,8 +77,8 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
private final ItemManagerModel<T> model;
private Predicate<? super T> filterPredicate = null;
private final Map<Class<? extends ItemFilter<? extends T>>, List<ItemFilter<? extends T>>> filters =
new HashMap<Class<? extends ItemFilter<? extends T>>, List<ItemFilter<? extends T>>>();
private final List<ItemFilter<? extends T>> orderedFilters = new ArrayList<ItemFilter<? extends T>>();
new HashMap<>();
private final List<ItemFilter<? extends T>> orderedFilters = new ArrayList<>();
private boolean wantUnique = false;
private boolean alwaysNonUnique = false;
private boolean allowMultipleSelections = false;
@@ -88,7 +88,7 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
private final Class<T> genericType;
private final CDetailPicture cDetailPicture;
private ItemManagerConfig config;
private final List<ListSelectionListener> selectionListeners = new ArrayList<ListSelectionListener>();
private final List<ListSelectionListener> selectionListeners = new ArrayList<>();
private final ItemFilter<? extends T> mainSearchFilter;
private final SkinnedPanel pnlButtons = new SkinnedPanel(new MigLayout("insets 0, gap 0, ax center, hidemode 3"));
@@ -125,7 +125,7 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
.tooltip("Toggle to show/hide options for current view")
.build();
private final List<ItemView<T>> views = new ArrayList<ItemView<T>>();
private final List<ItemView<T>> views = new ArrayList<>();
private final ItemListView<T> listView;
private final ImageView<T> imageView;
private ItemView<T> currentView;
@@ -143,12 +143,12 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
this.cDetailPicture = cDetailPicture;
this.genericType = genericType0;
this.wantUnique = wantUnique0;
this.model = new ItemManagerModel<T>(genericType0);
this.model = new ItemManagerModel<>(genericType0);
this.mainSearchFilter = createSearchFilter();
this.mainSearchFilter.setAllowRemove(false);
this.listView = new ItemListView<T>(this, this.model);
this.listView = new ItemListView<>(this, this.model);
this.imageView = createImageView(this.model);
this.views.add(this.listView);
@@ -157,7 +157,7 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
}
protected ImageView<T> createImageView(final ItemManagerModel<T> model0) {
return new ImageView<T>(this, model0);
return new ImageView<>(this, model0);
}
public final CDetailPicture getCDetailPicture() {
@@ -562,7 +562,7 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
*/
@Override
public ItemPool<T> getSelectedItemPool() {
final ItemPool<T> selectedItemPool = new ItemPool<T>(this.genericType);
final ItemPool<T> selectedItemPool = new ItemPool<>(this.genericType);
for (final T item : getSelectedItems()) {
selectedItemPool.add(item, getItemCount(item));
}
@@ -634,7 +634,7 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
*/
@Override
public boolean setSelectedStrings(final Iterable<String> strings) {
final List<T> items = new ArrayList<T>();
final List<T> items = new ArrayList<>();
for (final String str : strings) {
final T item = stringToItem(str);
if (item != null) {
@@ -652,7 +652,7 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
*/
@Override
public boolean selectItemEntrys(final Iterable<Entry<T, Integer>> itemEntrys) {
final List<T> items = new ArrayList<T>();
final List<T> items = new ArrayList<>();
for (final Entry<T, Integer> itemEntry : itemEntrys) {
items.add(itemEntry.getKey());
}
@@ -734,7 +734,7 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
if (this.isUnfiltered()) {
this.model.addItem(item, qty);
}
final List<T> items = new ArrayList<T>();
final List<T> items = new ArrayList<>();
items.add(item);
this.updateView(false, items);
}
@@ -755,7 +755,7 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
this.model.addItems(itemsToAdd);
}
final List<T> items = new ArrayList<T>();
final List<T> items = new ArrayList<>();
for (final Map.Entry<T, Integer> item : itemsToAdd) {
items.add(item.getKey());
}
@@ -859,7 +859,7 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
final Class<? extends ItemFilter<? extends T>> filterClass = (Class<? extends ItemFilter<? extends T>>) filter.getClass();
List<ItemFilter<? extends T>> classFilters = this.filters.get(filterClass);
if (classFilters == null) {
classFilters = new ArrayList<ItemFilter<? extends T>>();
classFilters = new ArrayList<>();
this.filters.put(filterClass, classFilters);
}
if (classFilters.size() > 0) {
@@ -936,7 +936,7 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel implem
public boolean applyFilters() {
if (this.lockFiltering || !this.initialized) { return false; }
final List<Predicate<? super T>> predicates = new ArrayList<Predicate<? super T>>();
final List<Predicate<? super T>> predicates = new ArrayList<>();
for (final ItemFilter<? extends T> filter : this.orderedFilters) { //TODO: Support custom filter logic
if (filter.isEnabled() && !filter.isEmpty()) {
predicates.add(filter.buildPredicate(this.genericType));

View File

@@ -38,7 +38,7 @@ public class AdvancedSearchFilter<T extends InventoryItem> extends ItemFilter<T>
public AdvancedSearchFilter(ItemManager<? super T> itemManager0) {
super(itemManager0);
model = new AdvancedSearch.Model<T>();
model = new AdvancedSearch.Model<>();
}
@Override
@@ -54,7 +54,7 @@ public class AdvancedSearchFilter<T extends InventoryItem> extends ItemFilter<T>
@Override
public ItemFilter<T> createCopy() {
return new AdvancedSearchFilter<T>(itemManager);
return new AdvancedSearchFilter<>(itemManager);
}
@Override

View File

@@ -44,7 +44,7 @@ public class CardCMCFilter extends StatTypeFilter<PaperCard> {
@Override
protected final Predicate<PaperCard> buildPredicate() {
final List<Predicate<CardRules>> cmcs = new ArrayList<Predicate<CardRules>>();
final List<Predicate<CardRules>> cmcs = new ArrayList<>();
for (StatTypes s : buttonMap.keySet()) {
if (s.predicate != null && buttonMap.get(s).isSelected()) {

View File

@@ -11,7 +11,7 @@ import forge.quest.QuestWorld;
public class CardQuestWorldFilter extends CardFormatFilter {
private final Set<QuestWorld> questWorlds = new HashSet<QuestWorld>();
private final Set<QuestWorld> questWorlds = new HashSet<>();
public CardQuestWorldFilter(final ItemManager<? super PaperCard> itemManager0) {
super(itemManager0);
@@ -72,7 +72,7 @@ public class CardQuestWorldFilter extends CardFormatFilter {
@Override
protected Iterable<String> getList() {
final Set<String> strings = new HashSet<String>();
final Set<String> strings = new HashSet<>();
for (final QuestWorld w : this.questWorlds) {
strings.add(w.getName());
}

View File

@@ -53,7 +53,7 @@ public class CardSearchFilter extends TextSearchFilter<PaperCard> {
protected final void buildWidget(JPanel widget) {
super.buildWidget(widget);
cbSearchMode = new FComboBoxWrapper<String>();
cbSearchMode = new FComboBoxWrapper<>();
cbSearchMode.addItem("in");
cbSearchMode.addItem("not in");
cbSearchMode.addTo(widget);

View File

@@ -14,7 +14,7 @@ import java.util.Set;
*
*/
public class CardSetFilter extends CardFormatFilter {
private final Set<String> sets = new HashSet<String>();
private final Set<String> sets = new HashSet<>();
public CardSetFilter(ItemManager<? super PaperCard> itemManager0, Collection<String> sets0, boolean allowReprints0) {
super(itemManager0);

View File

@@ -41,7 +41,7 @@ public class CardTypeFilter extends StatTypeFilter<PaperCard> {
@Override
protected final Predicate<PaperCard> buildPredicate() {
final List<Predicate<CardRules>> types = new ArrayList<Predicate<CardRules>>();
final List<Predicate<CardRules>> types = new ArrayList<>();
for (StatTypes s : buttonMap.keySet()) {
if (s.predicate != null && buttonMap.get(s).isSelected()) {

View File

@@ -13,7 +13,7 @@ import java.util.Set;
*
*/
public class DeckFolderFilter extends ListLabelFilter<DeckProxy> {
protected final Set<String> folders = new HashSet<String>();
protected final Set<String> folders = new HashSet<>();
public DeckFolderFilter(ItemManager<? super DeckProxy> itemManager0) {
super(itemManager0);

View File

@@ -11,7 +11,7 @@ import forge.quest.QuestWorld;
public class DeckQuestWorldFilter extends DeckFormatFilter {
private final Set<QuestWorld> questWorlds = new HashSet<QuestWorld>();
private final Set<QuestWorld> questWorlds = new HashSet<>();
public DeckQuestWorldFilter(final ItemManager<? super DeckProxy> itemManager0) {
super(itemManager0);
@@ -72,7 +72,7 @@ public class DeckQuestWorldFilter extends DeckFormatFilter {
@Override
protected Iterable<String> getList() {
final Set<String> strings = new HashSet<String>();
final Set<String> strings = new HashSet<>();
for (final QuestWorld w : this.questWorlds) {
strings.add(w.getName());
}

View File

@@ -11,7 +11,7 @@ import java.util.Set;
public class DeckSetFilter extends DeckFormatFilter {
private final Set<String> sets = new HashSet<String>();
private final Set<String> sets = new HashSet<>();
public DeckSetFilter(ItemManager<? super DeckProxy> itemManager0, Collection<String> sets0, boolean allowReprints0) {
super(itemManager0);

View File

@@ -13,7 +13,7 @@ import java.util.Set;
public abstract class FormatFilter<T extends InventoryItem> extends ListLabelFilter<T> {
protected boolean allowReprints = true;
protected final Set<GameFormat> formats = new HashSet<GameFormat>();
protected final Set<GameFormat> formats = new HashSet<>();
public FormatFilter(ItemManager<? super T> itemManager0) {
super(itemManager0);
@@ -25,8 +25,8 @@ public abstract class FormatFilter<T extends InventoryItem> extends ListLabelFil
@Override
protected String getTooltip() {
Set<String> sets = new HashSet<String>();
Set<String> bannedCards = new HashSet<String>();
Set<String> sets = new HashSet<>();
Set<String> bannedCards = new HashSet<>();
Set<String> additionalCards = new HashSet<>();
for (GameFormat format : this.formats) {
@@ -158,7 +158,7 @@ public abstract class FormatFilter<T extends InventoryItem> extends ListLabelFil
@Override
protected Iterable<String> getList() {
Set<String> strings = new HashSet<String>();
Set<String> strings = new HashSet<>();
for (GameFormat f : this.formats) {
strings.add(f.getName());
}

View File

@@ -45,10 +45,10 @@ public abstract class ListLabelFilter<T extends InventoryItem> extends ItemFilte
labelBuilder.append("s: All");
break;
case 1:
labelBuilder.append(": " + getList().iterator().next());
labelBuilder.append(": ").append(getList().iterator().next());
break;
default:
labelBuilder.append("s: " + TextUtil.join(getList(), ", "));
labelBuilder.append("s: ").append(TextUtil.join(getList(), ", "));
break;
}
label.setText(labelBuilder.toString());

View File

@@ -24,7 +24,7 @@ public abstract class StatTypeFilter<T extends InventoryItem> extends ToggleButt
public StatTypeFilter(ItemManager<? super T> itemManager0) {
super(itemManager0);
buttonMap = new HashMap<StatTypes, FLabel>();
buttonMap = new HashMap<>();
}
@SuppressWarnings("serial")
@@ -32,7 +32,7 @@ public abstract class StatTypeFilter<T extends InventoryItem> extends ToggleButt
final Localizer localizer = Localizer.getInstance();
StringBuilder tooltip = new StringBuilder();
tooltip.append(st.label);
tooltip.append(" (" + localizer.getMessage("lblclicktotoogle") + " ");
tooltip.append(" (").append(localizer.getMessage("lblclicktotoogle")).append(" ");
if (st.label.length() > 1 && !Character.isUpperCase(st.label.charAt(1))) {
tooltip.append(st.label.substring(0, 1).toLowerCase());
tooltip.append(st.label.substring(1));

View File

@@ -27,7 +27,7 @@ public class TextSearchFilter<T extends InventoryItem> extends ItemFilter<T> {
@Override
public ItemFilter<T> createCopy() {
TextSearchFilter<T> copy = new TextSearchFilter<T>(itemManager);
TextSearchFilter<T> copy = new TextSearchFilter<>(itemManager);
copy.getWidget(); //initialize widget
copy.txtSearch.setText(this.txtSearch.getText());
return copy;

View File

@@ -23,7 +23,7 @@ import forge.toolbox.LayoutHelper;
@SuppressWarnings("serial")
public abstract class ToggleButtonsFilter<T extends InventoryItem> extends ItemFilter<T> {
protected boolean lockFiltering;
private final List<FLabel> buttons = new ArrayList<FLabel>();
private final List<FLabel> buttons = new ArrayList<>();
protected ToggleButtonsFilter(ItemManager<? super T> itemManager0) {
super(itemManager0);

View File

@@ -51,7 +51,7 @@ public class TokenSearchFilter extends TextSearchFilter<PaperToken> {
protected final void buildWidget(JPanel widget) {
super.buildWidget(widget);
cbSearchMode = new FComboBoxWrapper<String>();
cbSearchMode = new FComboBoxWrapper<>();
cbSearchMode.addItem("in");
cbSearchMode.addItem("not in");
cbSearchMode.addTo(widget);

View File

@@ -71,7 +71,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
private static final int MAX_COLUMN_COUNT = 10;
private final CardViewDisplay display;
private final List<Integer> selectedIndices = new ArrayList<Integer>();
private final List<Integer> selectedIndices = new ArrayList<>();
private int columnCount = 4;
private boolean allowMultipleSelections;
private ColumnDef pileBy = null;
@@ -82,8 +82,8 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
private Point hoverScrollPos;
private ItemInfo hoveredItem;
private ItemInfo focalItem;
private final List<ItemInfo> orderedItems = new ArrayList<ItemInfo>();
private final List<Group> groups = new ArrayList<Group>();
private final List<ItemInfo> orderedItems = new ArrayList<>();
private final List<Group> groups = new ArrayList<>();
final Localizer localizer = Localizer.getInstance();
private static boolean isPreferenceEnabled(final ForgePreferences.FPref preferenceName) {
@@ -162,9 +162,9 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
}
private final ExpandCollapseButton btnExpandCollapseAll = new ExpandCollapseButton();
private final FComboBoxWrapper<Object> cbGroupByOptions = new FComboBoxWrapper<Object>();
private final FComboBoxWrapper<Object> cbPileByOptions = new FComboBoxWrapper<Object>();
private final FComboBoxWrapper<Integer> cbColumnCount = new FComboBoxWrapper<Integer>();
private final FComboBoxWrapper<Object> cbGroupByOptions = new FComboBoxWrapper<>();
private final FComboBoxWrapper<Object> cbPileByOptions = new FComboBoxWrapper<>();
private final FComboBoxWrapper<Integer> cbColumnCount = new FComboBoxWrapper<>();
public ImageView(final ItemManager<T> itemManager0, final ItemManagerModel<T> model0) {
super(itemManager0, model0);
@@ -588,7 +588,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
if (forRefresh && pileBy != null) { //refresh piles if needed
//use TreeMap to build pile set so iterating below sorts on key
ColumnDef groupPileBy = groupBy == null ? pileBy : groupBy.getGroupPileBy(i, pileBy);
Map<Comparable<?>, Pile> piles = new TreeMap<Comparable<?>, Pile>();
Map<Comparable<?>, Pile> piles = new TreeMap<>();
for (ItemInfo itemInfo : group.items) {
Comparable<?> key = groupPileBy.fnSort.apply(itemInfo);
if (!piles.containsKey(key)) {
@@ -597,9 +597,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
piles.get(key).items.add(itemInfo);
}
group.piles.clear();
for (Pile pile : piles.values()) {
group.piles.add(pile);
}
group.piles.addAll(piles.values());
}
groupY = y;
@@ -927,8 +925,8 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
}
}
private class Group extends DisplayArea {
private final List<ItemInfo> items = new ArrayList<ItemInfo>();
private final List<Pile> piles = new ArrayList<Pile>();
private final List<ItemInfo> items = new ArrayList<>();
private final List<Pile> piles = new ArrayList<>();
private final String name;
private boolean isCollapsed;
@@ -946,7 +944,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
}
}
private class Pile extends DisplayArea {
private final List<ItemInfo> items = new ArrayList<ItemInfo>();
private final List<ItemInfo> items = new ArrayList<>();
}
private class ItemInfo extends DisplayArea implements Entry<InventoryItem, Integer> {
private final T item;

View File

@@ -35,7 +35,6 @@ import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.LinkedList;
@@ -156,7 +155,7 @@ public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
final DefaultTableColumnModel colmodel = new DefaultTableColumnModel();
//ensure columns ordered properly
final List<ItemTableColumn> columns = new LinkedList<ItemTableColumn>();
final List<ItemTableColumn> columns = new LinkedList<>();
for (final ItemColumnConfig colConfig : config.getCols().values()) {
if (colOverrides == null || !colOverrides.containsKey(colConfig.getDef())) {
columns.add(new ItemTableColumn(new ItemColumn(colConfig)));
@@ -165,8 +164,9 @@ public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
columns.add(colOverrides.get(colConfig.getDef()));
}
}
Collections.sort(columns, new Comparator<ItemTableColumn>() {
@Override public int compare(final ItemTableColumn arg0, final ItemTableColumn arg1) {
columns.sort(new Comparator<ItemTableColumn>() {
@Override
public int compare(final ItemTableColumn arg0, final ItemTableColumn arg1) {
return Integer.compare(arg0.getIndex(), arg1.getIndex());
}
});
@@ -287,7 +287,7 @@ public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
@Override
public Iterable<Integer> getSelectedIndices() {
final List<Integer> indices = new ArrayList<Integer>();
final List<Integer> indices = new ArrayList<>();
final int[] selectedRows = this.table.getSelectedRows();
for (int i = 0; i < selectedRows.length; i++) {
indices.add(selectedRows[i]);

View File

@@ -179,7 +179,7 @@ public abstract class ItemView<T extends InventoryItem> {
}
public final Collection<T> getSelectedItems() {
final List<T> items = new ArrayList<T>();
final List<T> items = new ArrayList<>();
for (final Integer i : getSelectedIndices()) {
final T item = getItemAtIndex(i);
if (item != null) {
@@ -205,7 +205,7 @@ public abstract class ItemView<T extends InventoryItem> {
return setSelectedItems(items, true);
}
public final boolean setSelectedItems(final Iterable<T> items, final boolean scrollIntoView) {
final List<Integer> indices = new ArrayList<Integer>();
final List<Integer> indices = new ArrayList<>();
for (final T item : items) {
final int index = getIndexOfItem(item);
if (index != -1) {
@@ -249,7 +249,7 @@ public abstract class ItemView<T extends InventoryItem> {
final int count = getCount();
if (count == 0) { return; }
final List<Integer> indexList = new ArrayList<Integer>();
final List<Integer> indexList = new ArrayList<>();
for (final Integer index : indices) {
if (index >= 0 && index < count) {
indexList.add(index);

View File

@@ -24,7 +24,7 @@ public final class ForgeMenu {
private JPopupMenu popupMenu;
private IMenuProvider provider;
private static HashMap<KeyStroke, JMenuItem> activeShortcuts = new HashMap<KeyStroke, JMenuItem>();
private static HashMap<KeyStroke, JMenuItem> activeShortcuts = new HashMap<>();
public ForgeMenu() {
refresh();

View File

@@ -67,7 +67,7 @@ public class AddBasicLandsDialog {
private static final int ADD_BTN_SIZE = 30;
private static final int LAND_PANEL_PADDING = 3;
private final FComboBoxPanel<CardEdition> cbLandSet = new FComboBoxPanel<CardEdition>("Land Set:", FlowLayout.CENTER, Iterables.filter(StaticData.instance().getEditions(), CardEdition.Predicates.hasBasicLands));
private final FComboBoxPanel<CardEdition> cbLandSet = new FComboBoxPanel<>("Land Set:", FlowLayout.CENTER, Iterables.filter(StaticData.instance().getEditions(), CardEdition.Predicates.hasBasicLands));
private final MainPanel panel = new MainPanel();
private final LandPanel pnlPlains = new LandPanel("Plains");
@@ -313,7 +313,7 @@ public class AddBasicLandsDialog {
cardName = cardName0;
cardPanel = new LandCardPanel();
cbLandArt = new FComboBox<String>();
cbLandArt = new FComboBox<>();
cbLandArt.setFont(cbLandSet.getFont());
cbLandArt.addActionListener(new ActionListener() {
@Override

View File

@@ -69,7 +69,7 @@ public enum CDeckEditorUI implements ICDoc {
private final VTinyLeadersDecks vTinyLeadersDecks;
CDeckEditorUI() {
screenChildControllers = new HashMap<FScreen, ACEditorBase<? extends InventoryItem, ? extends DeckBase>>();
screenChildControllers = new HashMap<>();
this.cDetailPicture = new CDetailPicture();
this.vAllDecks = VAllDecks.SINGLETON_INSTANCE;
this.vAllDecks.setCDetailPicture(cDetailPicture);
@@ -163,7 +163,7 @@ public enum CDeckEditorUI implements ICDoc {
private <T extends InventoryItem> void moveSelectedItems(final ItemManager<T> itemManager, final _MoveAction moveAction, final int maxQty) {
if (maxQty == 0) { return; }
final ItemPool<T> items = new ItemPool<T>(itemManager.getGenericType());
final ItemPool<T> items = new ItemPool<>(itemManager.getGenericType());
for (final T item : itemManager.getSelectedItems()) {
final int qty = Math.min(maxQty, itemManager.getItemCount(item));
if (qty > 0) {

View File

@@ -85,8 +85,8 @@ public class DeckImport<TItem extends InventoryItem, TModel extends DeckBase> ex
private final FCheckBox dateTimeCheck = new FCheckBox("Use only sets released before:", false);
private final FCheckBox onlyCoreExpCheck = new FCheckBox("Use only core and expansion sets", true);
private final FComboBox<String> monthDropdown = new FComboBox<String>(); //don't need wrappers since skin can't change while this dialog is open
private final FComboBox<Integer> yearDropdown = new FComboBox<Integer>();
private final FComboBox<String> monthDropdown = new FComboBox<>(); //don't need wrappers since skin can't change while this dialog is open
private final FComboBox<Integer> yearDropdown = new FComboBox<>();
private final DeckImportController controller;
private final ACEditorBase<TItem, TModel> host;

View File

@@ -163,7 +163,7 @@ public abstract class ACEditorBase<TItem extends InventoryItem, TModel extends D
private ItemPool<TItem> createPoolForItem(final TItem item, final int qty) {
if (item == null || qty <= 0) { return null; }
final ItemPool<TItem> pool = new ItemPool<TItem>((Class<TItem>)item.getClass());
final ItemPool<TItem> pool = new ItemPool<>((Class<TItem>) item.getClass());
pool.add(item, qty);
return pool;
}

View File

@@ -63,7 +63,7 @@ public final class CEditorCommander extends CDeckEditor<Deck> {
private DragCell allDecksParent = null;
private DragCell deckGenParent = null;
private List<DeckSection> allSections = new ArrayList<DeckSection>();
private List<DeckSection> allSections = new ArrayList<>();
private final ItemPool<PaperCard> commanderPool;
private final ItemPool<PaperCard> normalPool;
@@ -114,16 +114,16 @@ public final class CEditorCommander extends CDeckEditor<Deck> {
CardCollections decks = FModel.getDecks();
switch (gameType) {
case TinyLeaders:
this.controller = new DeckController<Deck>(decks.getTinyLeaders(), this, newCreator);
this.controller = new DeckController<>(decks.getTinyLeaders(), this, newCreator);
break;
case Brawl:
this.controller = new DeckController<Deck>(decks.getBrawl(), this, newCreator);
this.controller = new DeckController<>(decks.getBrawl(), this, newCreator);
break;
case Oathbreaker:
this.controller = new DeckController<Deck>(decks.getOathbreaker(), this, newCreator);
this.controller = new DeckController<>(decks.getOathbreaker(), this, newCreator);
break;
default:
this.controller = new DeckController<Deck>(decks.getCommander(), this, newCreator);
this.controller = new DeckController<>(decks.getCommander(), this, newCreator);
break;
}

View File

@@ -58,7 +58,7 @@ import java.util.Map.Entry;
*/
public final class CEditorConstructed extends CDeckEditor<Deck> {
private DeckController<Deck> controller;
private final List<DeckSection> allSections = new ArrayList<DeckSection>();
private final List<DeckSection> allSections = new ArrayList<>();
private ItemPool<PaperCard> normalPool, avatarPool, planePool, schemePool, conspiracyPool, commanderPool;
Predicate<CardRules> commanderFilter;
@@ -149,19 +149,19 @@ public final class CEditorConstructed extends CDeckEditor<Deck> {
switch (this.gameType) {
case Constructed:
this.controller = new DeckController<Deck>(FModel.getDecks().getConstructed(), this, newCreator);
this.controller = new DeckController<>(FModel.getDecks().getConstructed(), this, newCreator);
break;
case Commander:
this.controller = new DeckController<Deck>(FModel.getDecks().getCommander(), this, newCreator);
this.controller = new DeckController<>(FModel.getDecks().getCommander(), this, newCreator);
break;
case Oathbreaker:
this.controller = new DeckController<Deck>(FModel.getDecks().getOathbreaker(), this, newCreator);
this.controller = new DeckController<>(FModel.getDecks().getOathbreaker(), this, newCreator);
break;
case Brawl:
this.controller = new DeckController<Deck>(FModel.getDecks().getBrawl(), this, newCreator);
this.controller = new DeckController<>(FModel.getDecks().getBrawl(), this, newCreator);
break;
case TinyLeaders:
this.controller = new DeckController<Deck>(FModel.getDecks().getTinyLeaders(), this, newCreator);
this.controller = new DeckController<>(FModel.getDecks().getTinyLeaders(), this, newCreator);
break;
}

View File

@@ -62,7 +62,7 @@ public final class CEditorLimited extends CDeckEditor<DeckGroup> {
private DragCell brawlDecksParent = null;
private DragCell tinyLeadersDecksParent = null;
private DragCell deckGenParent = null;
private final List<DeckSection> allSections = new ArrayList<DeckSection>();
private final List<DeckSection> allSections = new ArrayList<>();
//========== Constructor
@@ -92,7 +92,7 @@ public final class CEditorLimited extends CDeckEditor<DeckGroup> {
return new DeckGroup("");
}
};
this.controller = new DeckController<DeckGroup>(deckMap0, this, newCreator);
this.controller = new DeckController<>(deckMap0, this, newCreator);
getBtnAddBasicLands().setCommand(new UiCommand() {
@Override

View File

@@ -75,7 +75,7 @@ import java.util.Map.Entry;
public final class CEditorQuest extends CDeckEditor<Deck> {
private final QuestController questData;
private final DeckController<Deck> controller;
private final List<DeckSection> allSections = new ArrayList<DeckSection>();
private final List<DeckSection> allSections = new ArrayList<>();
private DragCell allDecksParent = null;
private DragCell deckGenParent = null;
@@ -139,7 +139,7 @@ public final class CEditorQuest extends CDeckEditor<Deck> {
}
};
this.controller = new DeckController<Deck>(questData0.getMyDecks(), this, newCreator);
this.controller = new DeckController<>(questData0.getMyDecks(), this, newCreator);
getBtnAddBasicLands().setCommand(new UiCommand() {
@Override
@@ -158,7 +158,7 @@ public final class CEditorQuest extends CDeckEditor<Deck> {
// fills number of decks using each card
private Map<PaperCard, Integer> countDecksForEachCard() {
final Map<PaperCard, Integer> result = new HashMap<PaperCard, Integer>();
final Map<PaperCard, Integer> result = new HashMap<>();
for (final Deck deck : this.questData.getMyDecks()) {
for (final Entry<PaperCard, Integer> e : deck.getMain()) {
final PaperCard card = e.getKey();
@@ -221,7 +221,7 @@ public final class CEditorQuest extends CDeckEditor<Deck> {
if (n == 0) {
s = "Remove custom rating";
} else {
s = "Rate this card as " + Integer.toString(n) + " stars";
s = "Rate this card as " + n + " stars";
}
GuiUtils.addMenuItem(cmb.getMenu(), s,
KeyStroke.getKeyStroke(48 + n, 0),
@@ -393,7 +393,7 @@ public final class CEditorQuest extends CDeckEditor<Deck> {
//Fixes null pointer error on switching tabs while quest deck editor is open. TODO: Find source of bug possibly?
if(sectionMode == null) sectionMode = DeckSection.Main;
final Map<ColumnDef, ItemTableColumn> colOverridesCatalog = new HashMap<ColumnDef, ItemTableColumn>();
final Map<ColumnDef, ItemTableColumn> colOverridesCatalog = new HashMap<>();
ItemTableColumn.addColOverride(ItemManagerConfig.QUEST_EDITOR_POOL, colOverridesCatalog, ColumnDef.NEW, this.questData.getCards().getFnNewCompare(), this.questData.getCards().getFnNewGet());
//Based on which section the editor is in, display the remaining card pool (or applicable card pool if in
@@ -428,8 +428,8 @@ public final class CEditorQuest extends CDeckEditor<Deck> {
public void update() {
this.decksUsingMyCards = this.countDecksForEachCard();
final Map<ColumnDef, ItemTableColumn> colOverridesCatalog = new HashMap<ColumnDef, ItemTableColumn>();
final Map<ColumnDef, ItemTableColumn> colOverridesDeck = new HashMap<ColumnDef, ItemTableColumn>();
final Map<ColumnDef, ItemTableColumn> colOverridesCatalog = new HashMap<>();
final Map<ColumnDef, ItemTableColumn> colOverridesDeck = new HashMap<>();
ItemTableColumn.addColOverride(ItemManagerConfig.QUEST_EDITOR_POOL, colOverridesCatalog, ColumnDef.NEW, this.questData.getCards().getFnNewCompare(), this.questData.getCards().getFnNewGet());
ItemTableColumn.addColOverride(ItemManagerConfig.QUEST_DECK_EDITOR, colOverridesDeck, ColumnDef.NEW, this.questData.getCards().getFnNewCompare(), this.questData.getCards().getFnNewGet());

View File

@@ -83,10 +83,10 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
private DragCell probsParent = null;
// remember changed gui elements
private String CCTabLabel = new String();
private String CCAddLabel = new String();
private String CDTabLabel = new String();
private String CDRemLabel = new String();
private String CCTabLabel = "";
private String CCAddLabel = "";
private String CDTabLabel = "";
private String CDRemLabel = "";
private String prevRem4Label = null;
private String prevRem4Tooltip = null;
private Runnable prevRem4Cmd = null;
@@ -209,8 +209,8 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
@SuppressWarnings("serial")
@Override
public void update() {
final Map<ColumnDef, ItemTableColumn> colOverridesCatalog = new HashMap<ColumnDef, ItemTableColumn>();
final Map<ColumnDef, ItemTableColumn> colOverridesDeck = new HashMap<ColumnDef, ItemTableColumn>();
final Map<ColumnDef, ItemTableColumn> colOverridesCatalog = new HashMap<>();
final Map<ColumnDef, ItemTableColumn> colOverridesDeck = new HashMap<>();
// Add spell shop-specific columns
ItemTableColumn.addColOverride(ItemManagerConfig.SPELL_SHOP, colOverridesCatalog, ColumnDef.PRICE, QuestSpellShop.fnPriceCompare, QuestSpellShop.fnPriceGet);
@@ -251,7 +251,7 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
double multiplier = QuestSpellShop.updateMultiplier();
this.cardsForSale = this.questData.getCards().getShopList();
final ItemPool<InventoryItem> ownedItems = new ItemPool<InventoryItem>(InventoryItem.class);
final ItemPool<InventoryItem> ownedItems = new ItemPool<>(InventoryItem.class);
ownedItems.addAllOfType(this.questData.getCards().getCardpool().getView());
this.getCatalogManager().setPool(cardsForSale);

View File

@@ -62,7 +62,7 @@ import java.util.Map.Entry;
public final class CEditorQuestLimited extends CDeckEditor<DeckGroup> {
private final QuestController questData;
private final DeckController<DeckGroup> controller;
private final List<DeckSection> allSections = new ArrayList<DeckSection>();
private final List<DeckSection> allSections = new ArrayList<>();
private DragCell allDecksParent = null;
private DragCell deckGenParent = null;
@@ -118,7 +118,7 @@ public final class CEditorQuestLimited extends CDeckEditor<DeckGroup> {
}
};
this.controller = new DeckController<DeckGroup>(questData0.getDraftDecks(), this, newCreator);
this.controller = new DeckController<>(questData0.getDraftDecks(), this, newCreator);
controller.getView().getDeckManager().setup(ItemManagerConfig.DRAFT_POOL);
controller.setModel(questData0.getDraftDecks().get(QuestEventDraft.DECK_NAME));
@@ -132,7 +132,7 @@ public final class CEditorQuestLimited extends CDeckEditor<DeckGroup> {
// fills number of decks using each card
private Map<PaperCard, Integer> countDecksForEachCard() {
final Map<PaperCard, Integer> result = new HashMap<PaperCard, Integer>();
final Map<PaperCard, Integer> result = new HashMap<>();
for (final Deck deck : this.questData.getMyDecks()) {
for (final Entry<PaperCard, Integer> e : deck.getMain()) {
final PaperCard card = e.getKey();
@@ -234,8 +234,8 @@ public final class CEditorQuestLimited extends CDeckEditor<DeckGroup> {
this.decksUsingMyCards = this.countDecksForEachCard();
final Map<ColumnDef, ItemTableColumn> colOverridesCatalog = new HashMap<ColumnDef, ItemTableColumn>();
final Map<ColumnDef, ItemTableColumn> colOverridesDeck = new HashMap<ColumnDef, ItemTableColumn>();
final Map<ColumnDef, ItemTableColumn> colOverridesCatalog = new HashMap<>();
final Map<ColumnDef, ItemTableColumn> colOverridesDeck = new HashMap<>();
ItemTableColumn.addColOverride(ItemManagerConfig.QUEST_EDITOR_POOL, colOverridesCatalog, ColumnDef.NEW, this.questData.getCards().getFnNewCompare(), this.questData.getCards().getFnNewGet());
ItemTableColumn.addColOverride(ItemManagerConfig.QUEST_DECK_EDITOR, colOverridesDeck, ColumnDef.NEW, this.questData.getCards().getFnNewCompare(), this.questData.getCards().getFnNewGet());

View File

@@ -24,10 +24,10 @@ public class CEditorTokenViewer extends ACEditorBase<PaperToken, DeckBase> {
private List<PaperToken> fullCatalogCards;
// remember changed gui elements
private String CCTabLabel = new String();
private String CCAddLabel = new String();
private String CDTabLabel = new String();
private String CDRemLabel = new String();
private String CCTabLabel = "";
private String CCAddLabel = "";
private String CDTabLabel = "";
private String CDRemLabel = "";
private String prevRem4Label = null;
private String prevRem4Tooltip = null;
private Runnable prevRem4Cmd = null;

View File

@@ -85,7 +85,7 @@ public final class CEditorVariant extends CDeckEditor<Deck> {
return new Deck();
}
};
this.controller = new DeckController<Deck>(folder, this, newCreator);
this.controller = new DeckController<>(folder, this, newCreator);
getBtnAddBasicLands().setCommand(new UiCommand() {
@Override

View File

@@ -61,17 +61,17 @@ public enum CProbabilities implements ICDoc {
final ACEditorBase<T, TModel> ed = (ACEditorBase<T, TModel>)
CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController();
if (ed == null) { return new ArrayList<String>(); }
if (ed == null) { return new ArrayList<>(); }
final ItemPool<PaperCard> deck = ItemPool.createFrom(ed.getDeckManager().getPool(), PaperCard.class);
final List<String> cardProbabilities = new ArrayList<String>();
final List<String> cardProbabilities = new ArrayList<>();
final List<PaperCard> shuffled = deck.toFlatList();
Collections.shuffle(shuffled, MyRandom.getRandom());
// Log totals of each card for decrementing
final Map<PaperCard, Integer> cardTotals = new HashMap<PaperCard, Integer>();
final Map<PaperCard, Integer> cardTotals = new HashMap<>();
for (final PaperCard c : shuffled) {
if (cardTotals.containsKey(c)) { cardTotals.put(c, cardTotals.get(c) + 1); }
else { cardTotals.put(c, 1); }

View File

@@ -136,7 +136,7 @@ public class DeckController<T extends DeckBase> {
}
private HashMap<String, Integer> groupByName(CardPool section) {
HashMap<String, Integer> result = new HashMap<String, Integer>();
HashMap<String, Integer> result = new HashMap<>();
for (Map.Entry<PaperCard, Integer> entry : section) {
PaperCard importedCard = entry.getKey();
@@ -190,7 +190,7 @@ public class DeckController<T extends DeckBase> {
}
private HashMap<String, PaperCard> getBasicLandsByName(CardPool sourceSection) {
HashMap<String, PaperCard> result = new HashMap<String, PaperCard>();
HashMap<String, PaperCard> result = new HashMap<>();
for (Map.Entry<PaperCard, Integer> entry : sourceSection) {
PaperCard card = entry.getKey();

View File

@@ -13,7 +13,7 @@ public class CDeckEditorUIMenus {
private final boolean SHOW_ICONS = true;
public List<JMenu> getMenus() {
List<JMenu> menus = new ArrayList<JMenu>();
List<JMenu> menus = new ArrayList<>();
menus.add(DeckFileMenu.getMenu(SHOW_ICONS));
return menus;
}

View File

@@ -2,6 +2,7 @@ package forge.screens.home;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Arrays;
import java.util.Vector;
import javax.swing.SwingUtilities;
@@ -27,10 +28,8 @@ public class CLobby {
}
private void addDecks(final Iterable<DeckProxy> commanderDecks, FList<Object> deckList, String... initialItems) {
Vector<Object> listData = new Vector<Object>();
for (String item : initialItems) {
listData.add(item);
}
Vector<Object> listData = new Vector<>();
listData.addAll(Arrays.asList(initialItems));
listData.add("Generate");
if (!Iterables.isEmpty(commanderDecks)) {
listData.add("Random");

View File

@@ -75,8 +75,8 @@ public class PlayerPanel extends FPanel {
private FRadioButton radioOpen;
private FCheckBox chkReady;
private final FComboBoxWrapper<Object> teamComboBox = new FComboBoxWrapper<Object>();
private final FComboBoxWrapper<Object> aeTeamComboBox = new FComboBoxWrapper<Object>();
private final FComboBoxWrapper<Object> teamComboBox = new FComboBoxWrapper<>();
private final FComboBoxWrapper<Object> aeTeamComboBox = new FComboBoxWrapper<>();
private final FLabel closeBtn;
private final FLabel deckBtn = new FLabel.ButtonBuilder().text(localizer.getMessage("lblSelectaDeck")).build();

View File

@@ -85,9 +85,9 @@ public enum VHomeUI implements IVTopLevelUI {
private final SkinColor clrTheme = FSkin.getColor(FSkin.Colors.CLR_THEME);
private final SkinColor l00 = clrTheme.stepColor(0);
private final List<IVSubmenu<? extends ICDoc>> allSubmenus = new ArrayList<IVSubmenu<? extends ICDoc>>();
private final Map<EDocID, LblMenuItem> allSubmenuLabels = new HashMap<EDocID, LblMenuItem>();
private final Map<EMenuGroup, LblGroup> allGroupLabels = new HashMap<EMenuGroup, LblGroup>();
private final List<IVSubmenu<? extends ICDoc>> allSubmenus = new ArrayList<>();
private final Map<EDocID, LblMenuItem> allSubmenuLabels = new HashMap<>();
private final Map<EMenuGroup, LblGroup> allGroupLabels = new HashMap<>();
private final PnlMenu pnlMenu = new PnlMenu();
private final PnlDisplay pnlDisplay = new PnlDisplay();
@@ -144,7 +144,7 @@ public enum VHomeUI implements IVTopLevelUI {
allSubmenus.add(VSubmenuReleaseNotes.SINGLETON_INSTANCE);
// For each group: init its panel
final SortedMap<EMenuGroup, JPanel> allGroupPanels = new TreeMap<EMenuGroup, JPanel>();
final SortedMap<EMenuGroup, JPanel> allGroupPanels = new TreeMap<>();
for (final EMenuGroup e : EMenuGroup.values()) {
allGroupPanels.put(e, new PnlGroup());
allGroupPanels.get(e).setVisible(false);

View File

@@ -82,7 +82,7 @@ public class VLobby implements ILobbyView {
// Player frame elements
private final JPanel playersFrame = new JPanel(new MigLayout("insets 0, gap 0 5, wrap, hidemode 3"));
private final FScrollPanel playersScroll = new FScrollPanel(new MigLayout("insets 0, gap 0, wrap, hidemode 3"), true);
private final List<PlayerPanel> playerPanels = new ArrayList<PlayerPanel>(MAX_PLAYERS);
private final List<PlayerPanel> playerPanels = new ArrayList<>(MAX_PLAYERS);
private final FLabel addPlayerBtn = new FLabel.ButtonBuilder().fontSize(14).text(localizer.getMessage("lblAddAPlayer")).build();
@@ -99,21 +99,21 @@ public class VLobby implements ILobbyView {
private final List<FDeckChooser> tinyLeadersDeckChoosers = Lists.newArrayListWithCapacity(MAX_PLAYERS);
private final List<FDeckChooser> brawlDeckChoosers = Lists.newArrayListWithCapacity(MAX_PLAYERS);
private final List<FList<Object>> schemeDeckLists = new ArrayList<FList<Object>>();
private final List<FPanel> schemeDeckPanels = new ArrayList<FPanel>(MAX_PLAYERS);
private final List<FList<Object>> schemeDeckLists = new ArrayList<>();
private final List<FPanel> schemeDeckPanels = new ArrayList<>(MAX_PLAYERS);
private final List<FList<Object>> planarDeckLists = new ArrayList<FList<Object>>();
private final List<FPanel> planarDeckPanels = new ArrayList<FPanel>(MAX_PLAYERS);
private final List<FList<Object>> planarDeckLists = new ArrayList<>();
private final List<FPanel> planarDeckPanels = new ArrayList<>(MAX_PLAYERS);
private final List<FList<Object>> vgdAvatarLists = new ArrayList<FList<Object>>();
private final List<FPanel> vgdPanels = new ArrayList<FPanel>(MAX_PLAYERS);
private final List<CardDetailPanel> vgdAvatarDetails = new ArrayList<CardDetailPanel>();
private final List<PaperCard> vgdAllAvatars = new ArrayList<PaperCard>();
private final List<PaperCard> vgdAllAiAvatars = new ArrayList<PaperCard>();
private final List<PaperCard> nonRandomHumanAvatars = new ArrayList<PaperCard>();
private final List<PaperCard> nonRandomAiAvatars = new ArrayList<PaperCard>();
private final Vector<Object> humanListData = new Vector<Object>();
private final Vector<Object> aiListData = new Vector<Object>();
private final List<FList<Object>> vgdAvatarLists = new ArrayList<>();
private final List<FPanel> vgdPanels = new ArrayList<>(MAX_PLAYERS);
private final List<CardDetailPanel> vgdAvatarDetails = new ArrayList<>();
private final List<PaperCard> vgdAllAvatars = new ArrayList<>();
private final List<PaperCard> vgdAllAiAvatars = new ArrayList<>();
private final List<PaperCard> nonRandomHumanAvatars = new ArrayList<>();
private final List<PaperCard> nonRandomAiAvatars = new ArrayList<>();
private final Vector<Object> humanListData = new Vector<>();
private final Vector<Object> aiListData = new Vector<>();
public boolean isForCommander() {
return isForCommander;
@@ -486,7 +486,7 @@ public class VLobby implements ILobbyView {
deckPanel.add(new FLabel.Builder().text("Select " + formatName)
.fontStyle(Font.BOLD).fontSize(14).fontAlign(SwingConstants.CENTER)
.build(), "gaptop 10px, gapbottom 5px, growx, pushx");
final FList<Object> deckList = new FList<Object>();
final FList<Object> deckList = new FList<>();
deckList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
deckList.addListSelectionListener(selectionListener);
@@ -902,7 +902,7 @@ public class VLobby implements ILobbyView {
}
List<String> getPlayerNames() {
final List<String> names = new ArrayList<String>();
final List<String> names = new ArrayList<>();
for (final PlayerPanel pp : playerPanels) {
names.add(pp.getPlayerName());
}

View File

@@ -31,7 +31,7 @@ public enum CSubmenuGauntletBuild implements ICDoc {
SINGLETON_INSTANCE;
private final VSubmenuGauntletBuild view = VSubmenuGauntletBuild.SINGLETON_INSTANCE;
private final List<Deck> workingDecks = new ArrayList<Deck>();
private final List<Deck> workingDecks = new ArrayList<>();
private final File openStartDir = new File(ForgeConstants.GAUNTLET_DIR.userPrefLoc);
private final FileFilter filterDAT = new FileFilter() {
@@ -169,7 +169,7 @@ public enum CSubmenuGauntletBuild implements ICDoc {
}
private void dumpDecksIntoList() {
final List<String> names = new ArrayList<String>();
final List<String> names = new ArrayList<>();
for (final Deck d : workingDecks) {
names.add(d.getName());
@@ -211,7 +211,7 @@ public enum CSubmenuGauntletBuild implements ICDoc {
gd = new GauntletData();
}
final List<String> names = new ArrayList<String>();
final List<String> names = new ArrayList<>();
for (final Deck d : workingDecks) {
names.add(d.getName());
}

View File

@@ -66,7 +66,7 @@ public enum CSubmenuGauntletContests implements ICDoc {
private void updateData() {
final File[] files = GauntletIO.getGauntletFilesLocked();
final List<GauntletData> data = new ArrayList<GauntletData>();
final List<GauntletData> data = new ArrayList<>();
if (files != null) {
for (final File f : files) {
final GauntletData gd = GauntletIO.loadGauntlet(f);
@@ -105,7 +105,7 @@ public enum CSubmenuGauntletContests implements ICDoc {
final Deck aiDeck = gd.getDecks().get(gd.getCompleted());
final List<RegisteredPlayer> starter = new ArrayList<RegisteredPlayer>();
final List<RegisteredPlayer> starter = new ArrayList<>();
final RegisteredPlayer human = new RegisteredPlayer(gd.getUserDeck()).setPlayer(GamePlayerUtil.getGuiPlayer());
starter.add(human);
starter.add(new RegisteredPlayer(aiDeck).setPlayer(GamePlayerUtil.createAiPlayer()));

View File

@@ -92,7 +92,7 @@ public enum CSubmenuGauntletLoad implements ICDoc {
private void updateData() {
final File[] files = GauntletIO.getGauntletFilesUnlocked(null);
final List<GauntletData> data = new ArrayList<GauntletData>();
final List<GauntletData> data = new ArrayList<>();
for (final File f : files) {
final GauntletData gd = GauntletIO.loadGauntlet(f);
@@ -138,7 +138,7 @@ public enum CSubmenuGauntletLoad implements ICDoc {
}
});
final List<RegisteredPlayer> starter = new ArrayList<RegisteredPlayer>();
final List<RegisteredPlayer> starter = new ArrayList<>();
final RegisteredPlayer human = new RegisteredPlayer(userDeck).setPlayer(GamePlayerUtil.getGuiPlayer());
starter.add(human);
starter.add(new RegisteredPlayer(aiDeck).setPlayer(GamePlayerUtil.createAiPlayer()));

View File

@@ -68,7 +68,7 @@ public enum CSubmenuGauntletQuick implements ICDoc {
});
// Find appropriate filename for new save, create and set new save file.
final List<DeckType> allowedDeckTypes = new ArrayList<DeckType>();
final List<DeckType> allowedDeckTypes = new ArrayList<>();
if (view.getBoxColorDecks().isSelected()) { allowedDeckTypes.add(DeckType.COLOR_DECK); }
if (view.getBoxStandardColorDecks().isSelected()) { allowedDeckTypes.add(DeckType.STANDARD_COLOR_DECK); }
if (view.getBoxStandardGenDecks().isSelected()) { allowedDeckTypes.add(DeckType.STANDARD_CARDGEN_DECK); }
@@ -83,7 +83,7 @@ public enum CSubmenuGauntletQuick implements ICDoc {
final GauntletData gd = GauntletUtil.createQuickGauntlet(view.getLstDecks().getPlayer().getDeck(), view.getSliOpponents().getValue(), allowedDeckTypes, null);
final List<RegisteredPlayer> starter = new ArrayList<RegisteredPlayer>();
final List<RegisteredPlayer> starter = new ArrayList<>();
final RegisteredPlayer human = new RegisteredPlayer(gd.getUserDeck()).setPlayer(GamePlayerUtil.getGuiPlayer());
starter.add(human);
starter.add(new RegisteredPlayer(gd.getDecks().get(gd.getCompleted())).setPlayer(GamePlayerUtil.createAiPlayer()));

View File

@@ -4,7 +4,6 @@ import java.awt.Color;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@@ -44,10 +43,10 @@ public class ContestGauntletLister extends JPanel {
public void setGauntlets(final List<GauntletData> gd0) {
this.removeAll();
final List<RowPanel> tempRows = new ArrayList<RowPanel>();
final List<GauntletData> sorted = new ArrayList<GauntletData>();
for (final GauntletData gd : gd0) { sorted.add(gd); }
Collections.sort(sorted, new Comparator<GauntletData>() {
final List<RowPanel> tempRows = new ArrayList<>();
final List<GauntletData> sorted = new ArrayList<>();
sorted.addAll(gd0);
sorted.sort(new Comparator<GauntletData>() {
@Override
public int compare(final GauntletData x, final GauntletData y) {
return x.getName().compareTo(y.getName());
@@ -79,8 +78,8 @@ public class ContestGauntletLister extends JPanel {
name = gd.getName();
name = name.substring(GauntletIO.PREFIX_LOCKED.length());
progress = String.valueOf(Math.round(
((double) gd.getCompleted() / (double) gd.getDecks().size()) * 100)) + " %";
progress = Math.round(
((double) gd.getCompleted() / (double) gd.getDecks().size()) * 100) + " %";
if (gd.getUserDeck() == null) {
progress = "---";

View File

@@ -4,7 +4,6 @@ import java.awt.Color;
import java.awt.event.MouseEvent;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@@ -63,10 +62,10 @@ public class QuickGauntletLister extends JPanel {
public void refresh() {
this.removeAll();
final List<RowPanel> tempRows = new ArrayList<RowPanel>();
final List<GauntletData> sorted = new ArrayList<GauntletData>();
for (final GauntletData gd : gauntlets) { sorted.add(gd); }
Collections.sort(sorted, new Comparator<GauntletData>() {
final List<RowPanel> tempRows = new ArrayList<>();
final List<GauntletData> sorted = new ArrayList<>();
sorted.addAll(gauntlets);
sorted.sort(new Comparator<GauntletData>() {
@Override
public int compare(final GauntletData x, final GauntletData y) {
return x.getName().toLowerCase().compareTo(y.getName().toLowerCase());
@@ -110,8 +109,8 @@ public class QuickGauntletLister extends JPanel {
row.add(new FLabel.Builder().text(String.valueOf(gd.getDecks().size()))
.fontAlign(SwingConstants.RIGHT).build(),
"w 90px!, h 20px!, gap 0 0 5px 0");
row.add(new FLabel.Builder().text(String.valueOf(Math.round(
((double) gd.getCompleted() / (double) gd.getDecks().size()) * 100)) + "%")
row.add(new FLabel.Builder().text(Math.round(
((double) gd.getCompleted() / (double) gd.getDecks().size()) * 100) + "%")
.fontAlign(SwingConstants.RIGHT).build(),
"w 90px!, h 20px!, gap 0 0 5px 0");
this.add(row, "w 98%!, h 30px!, gap 1% 0 0 0");

View File

@@ -44,7 +44,7 @@ public enum VSubmenuGauntletBuild implements IVSubmenu<CSubmenuGauntletBuild> {
private final JPanel pnlDirections = new JPanel();
private final FDeckChooser lstLeft = new FDeckChooser(null, false, GameType.Constructed, false);
private final JList<String> lstRight = new FList<String>();
private final JList<String> lstRight = new FList<>();
private final FScrollPane scrRight = new FScrollPane(lstRight, true,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

View File

@@ -139,7 +139,7 @@ public enum CSubmenuOnlineLobby implements ICDoc, IMenuProvider {
*/
@Override
public List<JMenu> getMenus() {
final List<JMenu> menus = new ArrayList<JMenu>();
final List<JMenu> menus = new ArrayList<>();
menus.add(ConstructedGameMenu.getMenu());
return menus;
}

View File

@@ -48,7 +48,7 @@ public enum CSubmenuPuzzleCreate implements ICDoc, IMenuProvider {
@Override
public List<JMenu> getMenus() {
final List<JMenu> menus = new ArrayList<JMenu>();
final List<JMenu> menus = new ArrayList<>();
menus.add(PuzzleGameMenu.getMenu());
return menus;
}
@@ -104,7 +104,7 @@ public enum CSubmenuPuzzleCreate implements ICDoc, IMenuProvider {
}
});
final List<RegisteredPlayer> players = new ArrayList<RegisteredPlayer>();
final List<RegisteredPlayer> players = new ArrayList<>();
final RegisteredPlayer human = new RegisteredPlayer(new Deck()).setPlayer(GamePlayerUtil.getGuiPlayer());
human.setStartingHand(0);
players.add(human);

View File

@@ -67,7 +67,7 @@ public enum CSubmenuPuzzleSolve implements ICDoc, IMenuProvider {
@Override
public List<JMenu> getMenus() {
final List<JMenu> menus = new ArrayList<JMenu>();
final List<JMenu> menus = new ArrayList<>();
menus.add(PuzzleGameMenu.getMenu());
return menus;
}
@@ -96,7 +96,7 @@ public enum CSubmenuPuzzleSolve implements ICDoc, IMenuProvider {
}
});
final List<RegisteredPlayer> players = new ArrayList<RegisteredPlayer>();
final List<RegisteredPlayer> players = new ArrayList<>();
final RegisteredPlayer human = new RegisteredPlayer(new Deck()).setPlayer(GamePlayerUtil.getGuiPlayer());
human.setStartingHand(0);
players.add(human);

View File

@@ -153,7 +153,7 @@ public enum CSubmenuChallenges implements ICDoc {
view.getPnlChallenges().removeAll();
qCtrl.regenerateChallenges();
final List<QuestEventChallenge> challenges = new ArrayList<QuestEventChallenge>();
final List<QuestEventChallenge> challenges = new ArrayList<>();
for(final Object id : qCtrl.getAchievements().getCurrentChallenges()) {
challenges.add(qCtrl.getChallenges().get(id.toString()));
}
@@ -161,7 +161,7 @@ public enum CSubmenuChallenges implements ICDoc {
final JXButtonPanel grpPanel = new JXButtonPanel();
StringBuilder sb = new StringBuilder();
sb.append(localizer.getMessage("lblMatchBestof") + " ").append(FModel.getQuest().getMatchLength());
sb.append(localizer.getMessage("lblMatchBestof")).append(" ").append(FModel.getQuest().getMatchLength());
view.getCbxMatchLength().setSelectedItem(sb.toString());
boolean haveAnyChallenges = true;

View File

@@ -197,7 +197,7 @@ public enum CSubmenuDuels implements ICDoc {
view.getPnlDuels().add(grpPanel, "w 100%!");
StringBuilder sb = new StringBuilder();
sb.append(localizer.getMessage("lblMatchBestof") + " ").append(FModel.getQuest().getMatchLength());
sb.append(localizer.getMessage("lblMatchBestof")).append(" ").append(FModel.getQuest().getMatchLength());
view.getCbxMatchLength().setSelectedItem(sb.toString());
}
}

View File

@@ -101,7 +101,7 @@ public enum CSubmenuQuestData implements ICDoc {
@Override
public void run() {
customFormatCodes.clear();
Set<String> sets = new HashSet<String>();
Set<String> sets = new HashSet<>();
for(GameFormat format:dialog.getSelectedFormats()){
sets.addAll(format.getAllowedSetCodes());
}
@@ -133,7 +133,7 @@ public enum CSubmenuQuestData implements ICDoc {
@Override
public void run() {
customPrizeFormatCodes.clear();
Set<String> sets = new HashSet<String>();
Set<String> sets = new HashSet<>();
for(GameFormat format:dialog.getSelectedFormats()){
sets.addAll(format.getAllowedSetCodes());
}

View File

@@ -64,10 +64,10 @@ public class QuestFileLister extends JPanel {
/** @param qd0 &emsp; {@link forge.quest.data.QuestData}[] */
public void setQuests(List<QuestData> qd0) {
this.removeAll();
List<RowPanel> tempRows = new ArrayList<RowPanel>();
List<QuestData> sorted = new ArrayList<QuestData>();
for (QuestData qd : qd0) { sorted.add(qd); }
Collections.sort(sorted, new Comparator<QuestData>() {
List<RowPanel> tempRows = new ArrayList<>();
List<QuestData> sorted = new ArrayList<>();
sorted.addAll(qd0);
sorted.sort(new Comparator<QuestData>() {
@Override
public int compare(final QuestData x, final QuestData y) {
return x.getName().toLowerCase().compareTo(y.getName().toLowerCase());

View File

@@ -34,10 +34,10 @@ public enum VSubmenuChallenges implements IVSubmenu<CSubmenuChallenges>, IVQuest
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
private final StartButton btnStart = new StartButton();
private final FComboBoxWrapper<String> cbxPet = new FComboBoxWrapper<String>();
private final FComboBoxWrapper<String> cbxPet = new FComboBoxWrapper<>();
private final FCheckBox cbPlant = new FCheckBox(localizer.getMessage("cbSummonPlant"));
private final FComboBoxWrapper<String> cbxMatchLength = new FComboBoxWrapper<String>();
private final FComboBoxWrapper<String> cbxMatchLength = new FComboBoxWrapper<>();
private final FLabel lblZep = new FLabel.Builder().text(localizer.getMessage("htmlLaunchZeppelin"))
.hoverable(true).icon(FSkin.getIcon(FSkinProp.ICO_QUEST_ZEP))

View File

@@ -49,7 +49,7 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
private final FLabel lblTitleNew = new FLabel.Builder().text(localizer.getMessage("lblStartanewQuest")).opaque(true).fontSize(16).build();
String str=new String( ForgeConstants.QUEST_SAVE_DIR.replace('\\', '/'));
String str= ForgeConstants.QUEST_SAVE_DIR.replace('\\', '/');
private final FLabel lblOldQuests = new FLabel.Builder().text(localizer.getMessage("lblOldQuestData").replace("%s",str)).fontAlign(SwingConstants.CENTER).fontSize(12).build();
private final QuestFileLister lstQuests = new QuestFileLister();
private final FScrollPane scrQuests = new FScrollPane(lstQuests, false);

View File

@@ -89,7 +89,7 @@ public class ViewItem extends FPanel {
ViewItem.this.lblIcon.setIcon(i);
ViewItem.this.lblName.setText(bazaarItem.getPurchaseName());
ViewItem.this.lblPrice.setText("Cost: " + String.valueOf(bazaarItem.getBuyingPrice(qA)) + " credits");
ViewItem.this.lblPrice.setText("Cost: " + bazaarItem.getBuyingPrice(qA) + " credits");
String desc = bazaarItem.getPurchaseDescription(qA);
ViewItem.this.tarDesc.setText(FSkin.encodeSymbols(desc, false)); //encode in case there are mana symbols in description

View File

@@ -73,7 +73,7 @@ public class ViewStall extends JPanel {
this.pnlInventory = new JPanel();
this.scrInventory = new FScrollPane(this.pnlInventory, false);
this.parentView = v0;
this.lstItemPanels = new ArrayList<ViewItem>();
this.lstItemPanels = new ArrayList<>();
// Component styling
this.setOpaque(false);

View File

@@ -20,7 +20,7 @@ import forge.view.FDialog;
@SuppressWarnings("serial")
public class AvatarSelector extends FDialog {
private final List<FLabel> selectables = new ArrayList<FLabel>();
private final List<FLabel> selectables = new ArrayList<>();
private final Map<Integer, SkinImage> avatarMap = FSkin.getAvatars();
public AvatarSelector(final String playerName, final int currentIndex, final Collection<Integer> usedIndices) {

View File

@@ -49,7 +49,7 @@ public enum CSubmenuConstructed implements ICDoc, IMenuProvider {
*/
@Override
public List<JMenu> getMenus() {
final List<JMenu> menus = new ArrayList<JMenu>();
final List<JMenu> menus = new ArrayList<>();
menus.add(ConstructedGameMenu.getMenu());
return menus;
}

View File

@@ -160,7 +160,7 @@ public enum CSubmenuDraft implements ICDoc {
throw new IllegalStateException("Draft: Computer deck is null!");
}
final List<RegisteredPlayer> starter = new ArrayList<RegisteredPlayer>();
final List<RegisteredPlayer> starter = new ArrayList<>();
final RegisteredPlayer human = new RegisteredPlayer(humanDeck.getDeck()).setPlayer(GamePlayerUtil.getGuiPlayer());
starter.add(human);
starter.add(new RegisteredPlayer(aiDeck).setPlayer(GamePlayerUtil.createAiPlayer()));

View File

@@ -161,7 +161,7 @@ public enum CSubmenuSealed implements ICDoc {
throw new IllegalStateException("Sealed: Computer deck is null!");
}
final List<RegisteredPlayer> starter = new ArrayList<RegisteredPlayer>();
final List<RegisteredPlayer> starter = new ArrayList<>();
final RegisteredPlayer human = new RegisteredPlayer(humanDeck.getDeck()).setPlayer(GamePlayerUtil.getGuiPlayer());
starter.add(human);
starter.add(new RegisteredPlayer(aiDeck).setPlayer(GamePlayerUtil.createAiPlayer()));

View File

@@ -134,7 +134,7 @@ public enum CSubmenuWinston implements ICDoc {
throw new IllegalStateException("Draft: Computer deck is null!");
}
final List<RegisteredPlayer> starter = new ArrayList<RegisteredPlayer>();
final List<RegisteredPlayer> starter = new ArrayList<>();
final RegisteredPlayer human = new RegisteredPlayer(humanDeck.getDeck()).setPlayer(GamePlayerUtil.getGuiPlayer());
starter.add(human);
starter.add(new RegisteredPlayer(aiDeck).setPlayer(GamePlayerUtil.createAiPlayer()));

View File

@@ -46,7 +46,7 @@ public enum VSubmenuDraft implements IVSubmenu<CSubmenuDraft> {
private final JRadioButton radSingle = new FRadioButton(localizer.getMessage("lblPlayAnOpponent"));
private final JRadioButton radAll = new FRadioButton(localizer.getMessage("lblPlayAll7opponents"));
private final JComboBox<String> cbOpponent = new JComboBox<String>();
private final JComboBox<String> cbOpponent = new JComboBox<>();
private final JLabel lblInfo = new FLabel.Builder()
.fontAlign(SwingConstants.LEFT).fontSize(16).fontStyle(Font.BOLD)

View File

@@ -55,7 +55,7 @@ public enum VSubmenuSealed implements IVSubmenu<CSubmenuSealed> {
private final JRadioButton radSingle = new FRadioButton(localizer.getMessage("lblPlayAnOpponent"));
private final JRadioButton radAll = new FRadioButton(localizer.getMessage("lblPlayAll7opponents"));
private final JComboBox<String> cbOpponent = new JComboBox<String>();
private final JComboBox<String> cbOpponent = new JComboBox<>();
private final FLabel lblInfo = new FLabel.Builder()
.fontAlign(SwingConstants.LEFT).fontSize(16).fontStyle(Font.BOLD)

View File

@@ -47,7 +47,7 @@ public enum VSubmenuWinston implements IVSubmenu<CSubmenuWinston> {
private final StartButton btnStart = new StartButton();
private final DeckManager lstDecks = new DeckManager(GameType.Winston, CDeckEditorUI.SINGLETON_INSTANCE.getCDetailPicture());
private final JList<String> lstAI = new FList<String>();
private final JList<String> lstAI = new FList<>();
private final JLabel lblInfo = new FLabel.Builder()
.fontAlign(SwingConstants.LEFT).fontSize(16).fontStyle(Font.BOLD)

View File

@@ -63,7 +63,7 @@ public enum VSubmenuAchievements implements IVSubmenu<CSubmenuAchievements> {
private final FLabel lblTitle = new FLabel.Builder()
.text(localizer.getMessage("lblAchievements")).fontAlign(SwingConstants.CENTER)
.opaque(true).fontSize(16).build();
private final FComboBox<AchievementCollection> cbCollections = new FComboBox<AchievementCollection>();
private final FComboBox<AchievementCollection> cbCollections = new FComboBox<>();
private final TrophyCase trophyCase = new TrophyCase();
private final FScrollPane scroller = new FScrollPane(trophyCase, false,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

View File

@@ -234,14 +234,14 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
cniSB.append("-------------------\n\n");
for (CardEdition e : editions) {
nifSB.append("Edition: " + e.getName() + " " + "(" + e.getCode() + "/" + e.getCode2() + ")\n");
cniSB.append("Edition: " + e.getName() + " " + "(" + e.getCode() + "/" + e.getCode2() + ")\n");
nifSB.append("Edition: ").append(e.getName()).append(" ").append("(").append(e.getCode()).append("/").append(e.getCode2()).append(")\n");
cniSB.append("Edition: ").append(e.getName()).append(" ").append("(").append(e.getCode()).append("/").append(e.getCode2()).append(")\n");
String imagePath;
int artIndex = 1;
ArrayList<String> cis = new ArrayList<String>();
ArrayList<String> cis = new ArrayList<>();
HashMap<String, Integer> cardCount = new HashMap<String, Integer>();
HashMap<String, Integer> cardCount = new HashMap<>();
for (CardInSet c : e.getCards()) {
if (cardCount.containsKey(c.name)) {
cardCount.put(c.name, cardCount.get(c.name) + 1);
@@ -261,7 +261,7 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
}
if (cp == null) {
cniSB.append(" " + c + "\n");
cniSB.append(" ").append(c).append("\n");
notImplementedCount++;
continue;
}
@@ -274,7 +274,7 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
if (imagePath != null) {
File file = ImageKeys.getImageFile(imagePath);
if (file == null) {
nifSB.append(" " + imagePath + "\n");
nifSB.append(" ").append(imagePath).append("\n");
missingCount++;
}
}
@@ -287,7 +287,7 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
if (imagePath != null) {
File file = ImageKeys.getImageFile(imagePath);
if (file == null) {
nifSB.append(" " + imagePath + "\n");
nifSB.append(" ").append(imagePath).append("\n");
missingCount++;
}
}
@@ -310,7 +310,7 @@ public enum VSubmenuDownloaders implements IVSubmenu<CSubmenuDownloaders> {
String imgKey = token.getImageKey(i);
File file = ImageKeys.getImageFile(imgKey);
if (file == null) {
nifSB.append(" " + token.getImageFilename(i+1) + "\n");
nifSB.append(" ").append(token.getImageFilename(i + 1)).append("\n");
missingCount++;
}
}

View File

@@ -101,7 +101,6 @@ import forge.util.gui.SOptionPane;
import forge.view.FView;
import forge.view.arcane.CardPanel;
import forge.view.arcane.FloatingZone;
import forge.match.input.*;
/**
* Constructs instance of match UI controller, used as a single point of
@@ -122,7 +121,7 @@ public final class CMatchUI
private final TargetingOverlay targetingOverlay = new TargetingOverlay(this);
private FCollectionView<PlayerView> sortedPlayers;
private final Map<String, String> avatarImages = new HashMap<String, String>();
private final Map<String, String> avatarImages = new HashMap<>();
private boolean allHands;
private boolean showOverlay = true;
private JPopupMenu openAbilityMenu;
@@ -141,7 +140,7 @@ public final class CMatchUI
public CMatchUI() {
this.view = new VMatchUI(this);
this.screen = FScreen.getMatchScreen(this, view);
this.myDocs = new EnumMap<EDocID, IVDoc<? extends ICDoc>>(EDocID.class);
this.myDocs = new EnumMap<>(EDocID.class);
this.myDocs.put(EDocID.CARD_PICTURE, cDetailPicture.getCPicture().getView());
this.myDocs.put(EDocID.CARD_DETAIL, cDetailPicture.getCDetail().getView());
// only create an ante doc if playing for ante
@@ -258,7 +257,7 @@ public final class CMatchUI
final String[] indices = FModel.getPreferences().getPref(FPref.UI_AVATARS).split(",");
final List<VField> fields = new ArrayList<VField>();
final List<VField> fields = new ArrayList<>();
Singletons.getView().getLpnDocument().add(targetingOverlay.getPanel(), FView.TARGETING_LAYER);
targetingOverlay.getPanel().setSize(Singletons.getControl().getDisplaySize());
@@ -286,7 +285,7 @@ public final class CMatchUI
}
private void initHandViews() {
final List<VHand> hands = new ArrayList<VHand>();
final List<VHand> hands = new ArrayList<>();
final Iterable<PlayerView> localPlayers = getLocalPlayers();
int i = 0;
@@ -614,7 +613,7 @@ public final class CMatchUI
}
}
private List<CardPanel> getVisibleCardPanels() {
final List<CardPanel> panels = new ArrayList<CardPanel>();
final List<CardPanel> panels = new ArrayList<>();
for (final VHand h : view.getHands()) {
panels.addAll(h.getHandArea().getCardPanels());
}
@@ -951,7 +950,7 @@ public final class CMatchUI
return ImmutableMap.of(firstBlocker, damage);
}
final AtomicReference<Map<CardView, Integer>> result = new AtomicReference<Map<CardView,Integer>>();
final AtomicReference<Map<CardView, Integer>> result = new AtomicReference<>();
FThreads.invokeInEdtAndWait(new Runnable() {
@Override
public void run() {
@@ -969,7 +968,7 @@ public final class CMatchUI
// Sort players
FCollectionView<PlayerView> players = gameView.getPlayers();
if (players.size() == 2 && myPlayers != null && myPlayers.size() == 1 && myPlayers.get(0).equals(players.get(1))) {
players = new FCollection<PlayerView>(new PlayerView[] { players.get(1), players.get(0) });
players = new FCollection<>(new PlayerView[]{players.get(1), players.get(0)});
}
initMatch(players, myPlayers);

View File

@@ -80,7 +80,7 @@ public class GameLogPanel extends JPanel {
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.getViewport().add(scrollablePanel);
layer = new JLayer<FScrollPane>(scrollPane, layerUI);
layer = new JLayer<>(scrollPane, layerUI);
this.add(layer, "w 10:100%, h 100%");
}

View File

@@ -63,7 +63,7 @@ public class QuestWinLoseCardViewer extends FPanel {
*/
public QuestWinLoseCardViewer(final List<PaperCard> list) {
this.list = Collections.unmodifiableList(list);
this.jList = new FList<PaperCard>(new ChooserListModel());
this.jList = new FList<>(new ChooserListModel());
this.detail = new CardDetailPanel();
this.picture = new CardPicturePanel();
this.scroller = new FScrollPane(this.jList, false);

View File

@@ -63,12 +63,12 @@ import forge.view.arcane.util.CardPanelMouseListener;
public class TargetingOverlay {
private final CMatchUI matchUI;
private final OverlayPanel pnl = new OverlayPanel();
private final List<CardPanel> cardPanels = new ArrayList<CardPanel>();
private final List<Arc> arcsFoeAtk = new ArrayList<Arc>();
private final List<Arc> arcsFoeDef = new ArrayList<Arc>();
private final List<Arc> arcsFriend = new ArrayList<Arc>();
private final List<CardPanel> cardPanels = new ArrayList<>();
private final List<Arc> arcsFoeAtk = new ArrayList<>();
private final List<Arc> arcsFoeDef = new ArrayList<>();
private final List<Arc> arcsFriend = new ArrayList<>();
private final ArcAssembler assembler = new ArcAssembler();
private final Set<Integer> stackItemIDs = new HashSet<Integer>();
private final Set<Integer> stackItemIDs = new HashSet<>();
private static class Arc {
private final int x1, y1, x2, y2;
@@ -88,7 +88,7 @@ public class TargetingOverlay {
}
}
private final Set<CardView> cardsVisualized = new HashSet<CardView>();
private final Set<CardView> cardsVisualized = new HashSet<>();
private CardPanel activePanel = null;
//private long lastUpdated = System.currentTimeMillis(); // TODO: determine if timer is needed (see below)
@@ -158,7 +158,7 @@ public class TargetingOverlay {
//final Point docOffsets = FView.SINGLETON_INSTANCE.getLpnDocument().getLocationOnScreen();
// Locations of arc endpoint, per card, with ID as primary key.
final Map<Integer, Point> endpoints = new HashMap<Integer, Point>();
final Map<Integer, Point> endpoints = new HashMap<>();
Point cardLocOnScreen;
Point locOnScreen = this.getPanel().getLocationOnScreen();
@@ -306,7 +306,7 @@ public class TargetingOverlay {
}
private Map<Integer, Point> getCardEndpoints() {
final Map<Integer, Point> endpoints = new HashMap<Integer, Point>();
final Map<Integer, Point> endpoints = new HashMap<>();
Point cardLocOnScreen;
Point locOnScreen = this.getPanel().getLocationOnScreen();

View File

@@ -174,7 +174,7 @@ public class VAssignDamage {
final JPanel pnlDefenders = new JPanel();
pnlDefenders.setOpaque(false);
int cols = attackerHasTrample ? blockers.size() + 1 : blockers.size();
final String wrap = "wrap " + Integer.toString(cols);
final String wrap = "wrap " + cols;
pnlDefenders.setLayout(new MigLayout("insets 0, gap 0, ax center, " + wrap));
final FScrollPane scrDefenders = new FScrollPane(pnlDefenders, false);
@@ -403,7 +403,7 @@ public class VAssignDamage {
StringBuilder sb = new StringBuilder();
sb.append(dmg);
if( overkill >= 0 ) {
sb.append(" (" +localizer.getMessage("lblLethal"));
sb.append(" (").append(localizer.getMessage("lblLethal"));
if( overkill > 0 )
sb.append(" +").append(overkill);
sb.append(")");

View File

@@ -34,11 +34,11 @@ public class VAutoYields extends FDialog {
super();
setTitle("Auto-Yields");
autoYields = new ArrayList<String>();
autoYields = new ArrayList<>();
for (final String autoYield : matchUI.getAutoYields()) {
autoYields.add(autoYield);
}
lstAutoYields = new FList<String>(new AutoYieldsListModel());
lstAutoYields = new FList<>(new AutoYieldsListModel());
int x = PADDING;
int y = PADDING;

View File

@@ -29,8 +29,8 @@ import forge.view.FView;
* <br><br><i>(V at beginning of class name denotes a view class.)</i>
*/
public class VMatchUI implements IVTopLevelUI {
private List<VField> lstFields = new ArrayList<VField>();
private List<VHand> lstHands = new ArrayList<VHand>();
private List<VField> lstFields = new ArrayList<>();
private List<VHand> lstHands = new ArrayList<>();
// Other instantiations
private final CMatchUI control;

View File

@@ -117,8 +117,8 @@ public class CHand implements ICDoc {
ordering.addAll(cards);
}
final List<CardPanel> placeholders = new ArrayList<CardPanel>();
final List<CardPanel> cardPanels = new ArrayList<CardPanel>();
final List<CardPanel> placeholders = new ArrayList<>();
final List<CardPanel> cardPanels = new ArrayList<>();
for (final CardView card : ordering) {
CardPanel cardPanel = p.getCardPanel(card.getId());

View File

@@ -52,7 +52,7 @@ public class VAntes implements IVDoc<CAntes> {
private final JPanel pnl = new JPanel();
private final FScrollPane scroller = new FScrollPane(pnl, false);
private final SortedSet<AntePanel> allAntes = new TreeSet<AntePanel>();
private final SortedSet<AntePanel> allAntes = new TreeSet<>();
//========== Constructor
public VAntes(final CAntes controller) {

View File

@@ -181,7 +181,7 @@ public class VLog implements IVDoc<CLog> {
logEntries.removeAll(this.displayedLogEntries);
return logEntries;
}
return new ArrayList<GameLogEntry>();
return new ArrayList<>();
}
private void addNewLogEntriesToJPanel(final List<GameLogEntry> newLogEntries) {

View File

@@ -13,7 +13,7 @@ public class CWorkshopUIMenus {
private final boolean SHOW_ICONS = true;
public List<JMenu> getMenus() {
List<JMenu> menus = new ArrayList<JMenu>();
List<JMenu> menus = new ArrayList<>();
menus.add(WorkshopFileMenu.getMenu(SHOW_ICONS));
return menus;
}

View File

@@ -11,7 +11,7 @@ import java.util.Map;
* @author agetian
*/
class AsyncSoundRegistry {
static Map<String, Integer> soundsPlayed = new HashMap<String, Integer>();
static Map<String, Integer> soundsPlayed = new HashMap<>();
public synchronized static void registerSound(String soundName) {
if (soundsPlayed.containsKey(soundName)) {

Some files were not shown because too many files have changed in this diff Show More