Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   getNumberArray(String) is deprecated (http://www.chiefdelphi.com/forums/showthread.php?t=146254)

Jeringo 25-03-2016 20:51

getNumberArray(String) is deprecated
 
I am trying to get an array value from network tables in java but can't seem to get it right.
currently using this...
Code:

double[] width = Table.getNumberArray("width");
but I am getting this
Code:

The method getNumberArray(String) from the type NetworkTable is deprecated
how would I fix this?

nighterfighter 25-03-2016 22:17

Re: getNumberArray(String) is deprecated
 
Deprecated methods means that they are old or may no longer be supported/may be removed in a future update.

However, they should still work. I assume you aren't getting an error, but rather a warning.




As for fixing it: You'd have to use the new way of doing what you are trying to do. I don't know what it is called off the top of my head.

soundfx 25-03-2016 22:59

Re: getNumberArray(String) is deprecated
 
Quote:

Originally Posted by nighterfighter (Post 1563130)
You'd have to use the new way of doing what you are trying to do. I don't know what it is called off the top of my head.

This new method allows you to set a default value as a second parameter to return if no value can be found. The new method is getNumberArray(String key, Double[] defaultValue).

Jeringo 25-03-2016 23:42

Re: getNumberArray(String) is deprecated
 
Quote:

Originally Posted by soundfx (Post 1563134)
This new method allows you to set a default value as a second parameter to return if no value can be found. The new method is getNumberArray(String key, Double[] defaultValue).

after using
Code:

double[] defaultval = new double[0];
getNumberArray("width", defaultval );

it says defaultval is a double but it needs to be a double[]
forgive me if im missing something very obvious switched over to java 4 days ago and arrays are not my strong suit

nighterfighter 25-03-2016 23:44

Re: getNumberArray(String) is deprecated
 
Quote:

Originally Posted by Jeringo (Post 1563143)
after using
Code:

getNumberArray("width", double[] 0.0)
i get a misplaced constructs on double[]

Try this:

Double[] x = {0.0};

getNumberArray("width", x);

Jeringo 26-03-2016 00:06

Re: getNumberArray(String) is deprecated
 
Quote:

Originally Posted by nighterfighter (Post 1563144)
Try this:

Double[] x = {0.0};

getNumberArray("width", x);

this worked thank you


All times are GMT -5. The time now is 09:59.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi