[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JAVA API : getElementType()

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.


  • Subject: Re: JAVA API : getElementType()
  • Date: Fri, 16 May 2003 13:46:12 -0600

Visweswara Rao Kottapalli wrote:

hello,

getElementType() in the class Array takes a long time to return the type
of the elements in the array. I found this to be unusual. Its taking
around 2.5 seconds to return a datatype.

Am writing a small piece of code for better understanding of what am
talking.

Variable v;
String elementType = v.read().getElementType().toString();

The getElementType() method is taking almost 2.5 seconds to return the
dataType of the elements in the array.

Thanks
Visweswara Rao Kottapalli

its the v.read() that can potentially take that long. you are reading the entire array into memory.

use

 v.getElementType();

it will return the same value instantaneously.