I have to translate a program written in Visual Basic into Java for my school test because I'm not really knowledgeable in VB. My questions are:
- Does Java have a "Single" type? The program declares a couple of variables as Single. I'm not familiar with the Single type is.
- Is using ArrayList in Java the same as changing the size of an array in VB with ReDim?
I think I have more questions, but I can't think of them right now. Maybe it's better if I just show a part of the code in the VB program so you know what I'm looking at.
#Region "Declarations"
Const _default_capacity As Integer = 16
Const _default_growth_factor As Single = 1.25
Private _growth_factor As Single
Private _count As Integer
Private _arr() As Object
#End Region
#Region "Constructors"
Public Sub New(Optional ByVal new_capacity As Integer = _default_capacity, Optional ByVal new_growth_factor As Single = _default_growth_factor)
ReDim _arr(new_capacity - 1)
_count = 0
If new_growth_factor <= 1.0 Then
new_growth_factor = _default_growth_factor
End If
_growth_factor = new_growth_factor
End Sub
Public Sub New(ByVal other As CArray)
ReDim _arr(other._arr.GetUpperBound(0))
_growth_factor = other._growth_factor
_count = other._count
For index As Integer = 0 To _count - 1
_arr(index) = other._arr(index)
Next
End Sub
#End Region