object in

A discussion forum for the JCommon class library.
Locked
Randy Kemp

object in

Post by Randy Kemp » Wed Feb 20, 2002 9:57 pm

The constructor for
DefaultCategoryDataset(String[] seriesNames, Object[] categories, Number[][] data) in 5.5 is listed like this.
My code before used DefaultCategoryDataset(seriesNames, categories, data);
where seriesNames was an arraylist
categories was an arraylist
data was Number[][]
For 5.5, I converted seriesNames to a string array. But I am a bit confused about Object[]. Can I cast an Arraylist to an object and vice versa? If so, how do I briefly code it?

David Gilbert

Re: object in

Post by David Gilbert » Mon Mar 18, 2002 10:24 am

Hi Randy,

Sorry for the delay...

The List interface defines a method toArray() so you can use that from your ArrayList to create an array of Objects.

The Arrays class (a utility class) defines a method asList(Object[]) that returns a List of objects from an array.

Hope that helps,

Dave Gilbert

Locked