Go to Post There will inevitably be enough unintentional failure in any endeavor we take on that adding intentional failure on top of that seems unnecessary. - Jared Russell [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 25-03-2016, 20:51
Jeringo Jeringo is offline
Registered User
FRC #4749
 
Join Date: Jan 2016
Location: Atlanta
Posts: 10
Jeringo is an unknown quantity at this point
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?
  #2   Spotlight this post!  
Unread 25-03-2016, 22:17
nighterfighter nighterfighter is offline
1771 Alum, 1771 Mentor
AKA: Matt B
FRC #1771 (1771)
Team Role: Mentor
 
Join Date: Sep 2009
Rookie Year: 2007
Location: Suwanee/Kennesaw, GA
Posts: 835
nighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant future
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.
__________________
1771- Programmer, Captain, Drive Team (2009-2012)
4509- Mentor (2013-2015)
1771- Mentor (2015)
  #3   Spotlight this post!  
Unread 25-03-2016, 22:59
soundfx's Avatar
soundfx soundfx is offline
Registered User
AKA: Aaron J
FRC #3238 (Cyborg Ferrets)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: Anacortes, WA
Posts: 17
soundfx is an unknown quantity at this point
Re: getNumberArray(String) is deprecated

Quote:
Originally Posted by nighterfighter View Post
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).
  #4   Spotlight this post!  
Unread 25-03-2016, 23:42
Jeringo Jeringo is offline
Registered User
FRC #4749
 
Join Date: Jan 2016
Location: Atlanta
Posts: 10
Jeringo is an unknown quantity at this point
Re: getNumberArray(String) is deprecated

Quote:
Originally Posted by soundfx View Post
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

Last edited by Jeringo : 25-03-2016 at 23:55.
  #5   Spotlight this post!  
Unread 25-03-2016, 23:44
nighterfighter nighterfighter is offline
1771 Alum, 1771 Mentor
AKA: Matt B
FRC #1771 (1771)
Team Role: Mentor
 
Join Date: Sep 2009
Rookie Year: 2007
Location: Suwanee/Kennesaw, GA
Posts: 835
nighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant future
Re: getNumberArray(String) is deprecated

Quote:
Originally Posted by Jeringo View Post
after using
Code:
getNumberArray("width", double[] 0.0)
i get a misplaced constructs on double[]
Try this:

Double[] x = {0.0};

getNumberArray("width", x);
__________________
1771- Programmer, Captain, Drive Team (2009-2012)
4509- Mentor (2013-2015)
1771- Mentor (2015)
  #6   Spotlight this post!  
Unread 26-03-2016, 00:06
Jeringo Jeringo is offline
Registered User
FRC #4749
 
Join Date: Jan 2016
Location: Atlanta
Posts: 10
Jeringo is an unknown quantity at this point
Re: getNumberArray(String) is deprecated

Quote:
Originally Posted by nighterfighter View Post
Try this:

Double[] x = {0.0};

getNumberArray("width", x);
this worked thank you
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 20:57.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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