diff options
-rw-r--r-- | src/classes/share/javax/media/j3d/VirtualUniverse.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/classes/share/javax/media/j3d/VirtualUniverse.java b/src/classes/share/javax/media/j3d/VirtualUniverse.java index f8f736f..3928908 100644 --- a/src/classes/share/javax/media/j3d/VirtualUniverse.java +++ b/src/classes/share/javax/media/j3d/VirtualUniverse.java @@ -609,8 +609,10 @@ public class VirtualUniverse extends Object { str = Long.toString(nodeIdCount); nodeIdCount++; } else { - str = (String) nodeIdFreeList.lastElement(); - nodeIdFreeList.removeElement(str); + // Issue 496: Remove last object using index to avoid performance + // hit of a needless linear search. + int idx = nodeIdFreeList.size() - 1; + str = (String) nodeIdFreeList.remove(idx); } return(str); } |