Re: Pg. 22, Developers Guide

Vikram Vatsa wrote:
> I saw that someone had previously been working on a similar problem and 
> was told to look in section 3.1.14 of the Developer's Guide for help.  
> There is a section of the code there that looks like this:
> 
>       //construct RealTupleType for grid coordinates
>       RealType[] types3d = {row, column, level};
> 
> The question I have is about the braces, {}, surrounding row, column, and
> level in the above line.  I'm afraid I'm not familiar with that specific use
> of braces as applied in Java.  Could someone please shed some light as to
> what exactly the above code does?  Perhaps a way to seed the array?

Yes, it is the same as:

        RealType[] types3d = new RealType[3];
        types3d[0] = row;
        types3d[0] = column;
        types3d[0] = level;

but is a bit more readable (once you know the idiom.)

  • 1999 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: