Kawa JTable String[][] arrays

Per Bothner per@bothner.com
Fri Nov 10 16:02:00 GMT 2017


On 11/10/2017 07:44 AM, Fabian Boucsein wrote:
> Thank you very much Per and Tom.
> 
> Per's version works very fine for me. Although i think they should be almost the same. What does ::String[][]? And maybe could you explain the difference between string and String?

'::TYPE' (or with a space as in ':: TYPE') is a "type specifier".
See https://www.gnu.org/software/kawa/Definitions.html.

(define data::String[][] [["Japan" "245"] ["USA" "240"]])

would probably be more readable as

(define data ::String[][] [["Japan" "245"] ["USA" "240"]])

(define data :: String[][] [["Japan" "245"] ["USA" "240"]])

Regardless it specifies that 'data' has the type "String[][]'.
Normally ["Japan" "245"] evaluates to an immutable vector,
but when the required type (in the static context) is a String[]
then the compiler converts it for you.  Similarly for String[][]/

You can write java.lang.String[][] instead of String[][].
They're not quite the same in terms what conversions they
handle, but specify the same data type.

The '[]' means a Java array type (as opposed to the multi-dimensional Scheme arrays).

https://www.gnu.org/software/kawa/Standard-Types.html
explains 'string' versus 'String'.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/



More information about the Kawa mailing list