Performance pass 1 (Fix array size)

This commit is contained in:
Andrew 2020-10-15 22:42:44 -07:00
parent c84c462aeb
commit f8f8b884bc
7 changed files with 10 additions and 10 deletions

View File

@ -298,7 +298,7 @@ public class NoiseExplorer extends JPanel implements MouseWheelListener
NoiseExplorer nv = new NoiseExplorer(); NoiseExplorer nv = new NoiseExplorer();
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
KList<String> li = new KList<NoiseStyle>(NoiseStyle.values()).toStringList(); KList<String> li = new KList<NoiseStyle>(NoiseStyle.values()).toStringList();
combo = new JComboBox<String>(li.toArray(new String[li.size()])); combo = new JComboBox<String>(li.toArray(new String[0]));
combo.setSelectedItem("STATIC"); combo.setSelectedItem("STATIC");
combo.setFocusable(false); combo.setFocusable(false);
combo.addActionListener(new ActionListener() combo.addActionListener(new ActionListener()

View File

@ -133,7 +133,7 @@ public class B
} }
} }
return bt.toArray(new String[bt.size()]); return bt.toArray(new String[0]);
} }
public static String[] getItemTypes() public static String[] getItemTypes()
@ -146,7 +146,7 @@ public class B
bt.add(v); bt.add(v);
} }
return bt.toArray(new String[bt.size()]); return bt.toArray(new String[0]);
} }
public static BlockData getBlockData(String bdxf, IrisDimension resolver) public static BlockData getBlockData(String bdxf, IrisDimension resolver)

View File

@ -153,7 +153,7 @@ public class ObjectResourceLoader extends ResourceLoader<IrisObject>
} }
KList<String> v = new KList<>(m); KList<String> v = new KList<>(m);
possibleKeys = v.toArray(new String[v.size()]); possibleKeys = v.toArray(new String[0]);
return possibleKeys; return possibleKeys;
} }
@ -201,7 +201,7 @@ public class ObjectResourceLoader extends ResourceLoader<IrisObject>
} }
KList<String> v = new KList<>(m); KList<String> v = new KList<>(m);
possibleKeys = v.toArray(new String[v.size()]); possibleKeys = v.toArray(new String[0]);
return possibleKeys; return possibleKeys;
} }

View File

@ -79,7 +79,7 @@ public class ResourceLoader<T extends IrisRegistrant>
} }
KList<String> v = new KList<>(m); KList<String> v = new KList<>(m);
preferredKeys = v.toArray(new String[v.size()]); preferredKeys = v.toArray(new String[0]);
return preferredKeys; return preferredKeys;
} }
@ -116,7 +116,7 @@ public class ResourceLoader<T extends IrisRegistrant>
} }
KList<String> v = new KList<>(m); KList<String> v = new KList<>(m);
possibleKeys = v.toArray(new String[v.size()]); possibleKeys = v.toArray(new String[0]);
return possibleKeys; return possibleKeys;
} }

View File

@ -117,7 +117,7 @@ public class V
try try
{ {
return (local ? Violator.getDeclaredMethod(o.getClass(), method, par.toArray(new Class<?>[par.size()])) : Violator.getMethod(o.getClass(), method, par.toArray(new Class<?>[par.size()]))).invoke(o, parameters); return (local ? Violator.getDeclaredMethod(o.getClass(), method, par.toArray(new Class<?>[0])) : Violator.getMethod(o.getClass(), method, par.toArray(new Class<?>[0]))).invoke(o, parameters);
} }
catch(Throwable e) catch(Throwable e)

View File

@ -191,7 +191,7 @@ public class Violator
try try
{ {
Constructor<?> co = getConstructor(c, cv.toArray(new Class<?>[cv.size()])); Constructor<?> co = getConstructor(c, cv.toArray(new Class<?>[0]));
return (T) co.newInstance(parameters); return (T) co.newInstance(parameters);
} }

View File

@ -115,7 +115,7 @@ public class VirtualCommand
return true; return true;
} }
return command.handle(vs, chain.toArray(new String[chain.size()])); return command.handle(vs, chain.toArray(new String[0]));
} }
private boolean checkPermissions(CommandSender sender, ICommand command2) private boolean checkPermissions(CommandSender sender, ICommand command2)