Cleanup - Collection.toArray

This commit is contained in:
Jetz
2024-08-10 10:25:35 -04:00
parent 158ff30ff8
commit ae9877ce3c
8 changed files with 10 additions and 10 deletions

View File

@@ -245,7 +245,7 @@ public final class NameGenerator {
Collections.addAll(all, fantasyMales); Collections.addAll(all, fantasyMales);
Collections.addAll(all, genericFemales); Collections.addAll(all, genericFemales);
Collections.addAll(all, fantasyFemales); Collections.addAll(all, fantasyFemales);
sourceList = all.toArray(new String[all.size()]); sourceList = all.toArray(new String[0]);
useMoniker = MyRandom.getRandom().nextFloat() <= 0.04f; useMoniker = MyRandom.getRandom().nextFloat() <= 0.04f;
break; break;
} }

View File

@@ -98,7 +98,7 @@ public abstract class StorageReaderRecursiveFolderWithUserFolder<T> extends Stor
forgeFormats.addAll(customFormats); forgeFormats.addAll(customFormats);
final File[] files = forgeFormats.toArray(new File[forgeFormats.size()]); final File[] files = forgeFormats.toArray(new File[0]);
for (final File file : files) { for (final File file : files) {
try { try {

View File

@@ -104,7 +104,7 @@ public class TokenInfo {
if (c.getType().isLegendary()) { if (c.getType().isLegendary()) {
relevantTypes.add("Legendary"); relevantTypes.add("Legendary");
} }
return relevantTypes.toArray(new String[relevantTypes.size()]); return relevantTypes.toArray(new String[0]);
} }
private Card toCard(Game game) { private Card toCard(Game game) {

View File

@@ -149,7 +149,7 @@ public class Untap extends Phase {
} }
} }
final CardCollection untapList = new CardCollection(list); final CardCollection untapList = new CardCollection(list);
final String[] restrict = restrictUntap.keySet().toArray(new String[restrictUntap.keySet().size()]); final String[] restrict = restrictUntap.keySet().toArray(new String[0]);
list = CardLists.filter(list, c -> { list = CardLists.filter(list, c -> {
if (!Untap.canUntap(c)) { if (!Untap.canUntap(c)) {
return false; return false;

View File

@@ -122,7 +122,7 @@ public class DialogChooseFormats {
choices.addAll(formats); choices.addAll(formats);
final FCheckBoxList<FCheckBox> cbl = new FCheckBoxList<>(false); final FCheckBoxList<FCheckBox> cbl = new FCheckBoxList<>(false);
cbl.setListData(formats.toArray(new FCheckBox[formats.size()])); cbl.setListData(formats.toArray(new FCheckBox[0]));
cbl.setVisibleRowCount(Math.min(20, formats.size())); cbl.setVisibleRowCount(Math.min(20, formats.size()));
if (focused) { if (focused) {

View File

@@ -209,7 +209,7 @@ public class FCheckBoxTree extends JTree {
} }
public TreePath[] getCheckedPaths() { public TreePath[] getCheckedPaths() {
return checkedPaths.toArray(new TreePath[checkedPaths.size()]); return checkedPaths.toArray(new TreePath[0]);
} }
/** /**
@@ -227,7 +227,7 @@ public class FCheckBoxTree extends JTree {
checkedValues.add(data.item); checkedValues.add(data.item);
} }
} }
return checkedValues.toArray(new Object[checkedValues.size()]); return checkedValues.toArray(new Object[0]);
} }
// Returns true in case that the node is selected, has children but not all of them are selected // Returns true in case that the node is selected, has children but not all of them are selected

View File

@@ -281,7 +281,7 @@ public class SpellSmithScene extends UIScene {
loadEditions(); //just to be safe since it's preloaded, if somehow edition is null, then reload it loadEditions(); //just to be safe since it's preloaded, if somehow edition is null, then reload it
editionList.clearListeners(); editionList.clearListeners();
editionList.clearItems(); editionList.clearItems();
editionList.setItems(editions.toArray(new CardEdition[editions.size()])); editionList.setItems(editions.toArray(new CardEdition[0]));
editionList.addListener(new ChangeListener() { editionList.addListener(new ChangeListener() {
@Override @Override
public void changed(ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {

View File

@@ -283,7 +283,7 @@ public class SoundSystem {
invalidateSoundCache(); invalidateSoundCache();
} }
return availableSets.toArray(new String[availableSets.size()]); return availableSets.toArray(new String[0]);
} }
public String getSoundDirectory() { public String getSoundDirectory() {
@@ -341,6 +341,6 @@ public class SoundSystem {
MusicPlaylist.invalidateMusicPlaylist(); MusicPlaylist.invalidateMusicPlaylist();
} }
return availableSets.toArray(new String[availableSets.size()]); return availableSets.toArray(new String[0]);
} }
} }