From 1eef41dcc6b25a0ec8f5ab1f148f285d17201f48 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Sun, 8 Jan 2012 00:28:29 -0800 Subject: j3dcore: pass ArrayList directly to j3dQueryProps rather than a temp array Signed-off-by: Harvey Harrison --- src/classes/share/javax/media/j3d/Canvas3D.java | 8 +++----- src/classes/share/javax/media/j3d/J3dQueryProps.java | 7 ++++--- src/classes/share/javax/media/j3d/VirtualUniverse.java | 12 +++++------- 3 files changed, 12 insertions(+), 15 deletions(-) (limited to 'src/classes') diff --git a/src/classes/share/javax/media/j3d/Canvas3D.java b/src/classes/share/javax/media/j3d/Canvas3D.java index a6d54b5..0a525f5 100644 --- a/src/classes/share/javax/media/j3d/Canvas3D.java +++ b/src/classes/share/javax/media/j3d/Canvas3D.java @@ -3708,8 +3708,8 @@ public class Canvas3D extends Canvas { */ private void createQueryProps() { // Create lists of keys and values - ArrayList keys = new ArrayList(); - ArrayList values = new ArrayList(); + ArrayList keys = new ArrayList(); + ArrayList values = new ArrayList(); int pass = 0; // properties not associated with graphics context @@ -3852,9 +3852,7 @@ public class Canvas3D extends Canvas { values.add(nativeGraphicsRenderer); // Now Create read-only properties object - queryProps = - new J3dQueryProps((String[]) keys.toArray(new String[0]), - values.toArray()); + queryProps = new J3dQueryProps(keys, values); } diff --git a/src/classes/share/javax/media/j3d/J3dQueryProps.java b/src/classes/share/javax/media/j3d/J3dQueryProps.java index 4d33419..b4467ba 100644 --- a/src/classes/share/javax/media/j3d/J3dQueryProps.java +++ b/src/classes/share/javax/media/j3d/J3dQueryProps.java @@ -33,6 +33,7 @@ package javax.media.j3d; import java.util.AbstractMap; import java.util.AbstractSet; +import java.util.ArrayList; import java.util.Hashtable; import java.util.Iterator; import java.util.Set; @@ -52,10 +53,10 @@ class J3dQueryProps extends AbstractMap { * array of keys and the specified values. The arrays must be * the same size. */ - J3dQueryProps(String[] keys, Object[] values) { + J3dQueryProps(ArrayList keys, ArrayList values) { table = new Hashtable(); - for (int i = 0; i < keys.length; i++) { - table.put(keys[i], values[i]); + for (int i = 0; i < keys.size(); i++) { + table.put(keys.get(i), values.get(i)); } } diff --git a/src/classes/share/javax/media/j3d/VirtualUniverse.java b/src/classes/share/javax/media/j3d/VirtualUniverse.java index 96bac95..b8fd79a 100644 --- a/src/classes/share/javax/media/j3d/VirtualUniverse.java +++ b/src/classes/share/javax/media/j3d/VirtualUniverse.java @@ -582,9 +582,9 @@ public Enumeration getAllLocales() { */ public static final Map getProperties() { if (properties == null) { - // Create lists of keys and values - ArrayList keys = new ArrayList(); - ArrayList values = new ArrayList(); + // Create lists of keys and values + ArrayList keys = new ArrayList(); + ArrayList values = new ArrayList(); // Implementation version string is obtained from the // ImplementationVersion class. @@ -606,10 +606,8 @@ public Enumeration getAllLocales() { keys.add("j3d.pipeline"); values.add(Pipeline.getPipeline().getPipelineName()); - // Now Create read-only properties object - properties = - new J3dQueryProps((String[]) keys.toArray(new String[0]), - values.toArray()); + // Now Create read-only properties object + properties = new J3dQueryProps(keys, values); } return properties; } -- cgit v1.2.3