Tangible Software Solutions

The Most Trusted Name in Source Code Conversion

Java Equivalent to VB ReDim Preserve

Resizing arrays while preserving the existing contents is easily done in VB using ReDim Preserve.  In Java, you have other alternatives:

Dim YourArray() As Integer
ReDim Preserve YourArray(i)

int[] YourArray;
int[] temp = new int[i + 1];
if (YourArray != null)
    System.arraycopy(YourArray, 0, temp, 0, Math.min(YourArray.length, temp.length));
YourArray = temp;

If you need to convert from VB to Java and you are depending on the results being reliable and accurate, then you will want to have VB to Java Converter, the best VB to Java converter, at your fingertips.

Copyright © 1997 - 2017 Tangible Software Solutions Inc.