Link to home
Start Free TrialLog in
Avatar of MarkLoveExEx
MarkLoveExEx

asked on

Pass in JList instead of hard-coding numbers

I have the following code that calls a class "m", passing in a List (and a double) as follows...

my_outlier = (double) m.getOutlier(Arrays.asList(1.1, 2.1, 31.1, 4, 3, 4), 0.95)

Open in new window


Notice that the List is hard-coded.  I need to pass in a List variable somehow, but I can't get it to work. The "asList" seems to need that hard-coded list of numbers within parenthesis. Any suggestions?
Avatar of MarkLoveExEx
MarkLoveExEx

ASKER

I think I solved it.  Simply substitute the list of doubles with "myList.toArray()".  I was missing the "toArray".
ASKER CERTIFIED SOLUTION
Avatar of mccarl
mccarl
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial