java - storing single values from an arraylist into an array -


i want values arraylist can graph them having trouble getting them array. in loop, looping on sorted hashmap , attempting store values in array(doesn't work).

long v [] = null;  for(map.entry<string,numberholder> entry : entries) {        v = entry.getvalue().singlevalues; } 

this numberholder class

private static class numberholder {     public int occurrences = 0;     public int sumtime_in_milliseconds = 0;      public arraylist<long> singlevalues = new arraylist<long>(); } 

i want array filled single values can graph it.

edit

this have now, , eclipse gives me never ending error suggestions of converting array object[] gives me problems when using dataset.addseries graph.

for(map.entry<string,numberholder> entry : entries) {     graphmaker(entry.getvalue().occurrences,entry.getvalue().singlevalues.toarray()); }                                           public static void graphmaker(int totalvalues, object[] objects) {      int bin = 1000;     histogramdataset dataset = new histogramdataset();     dataset.settype(histogramtype.relative_frequency);     dataset.addseries("histogram",objects,bin, 0, 120000); 

you can't assign arraylist array that. maybe use toarray method:

long v [] = null;  for(map.entry<string,numberholder> entry : entries) {    v = entry.getvalue().singlevalues.toarray(new long[0]); } 

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -