First one will help in terms of performance, I might emit the 100 values and arraylist default size is 10. So each time I hits limit it will end up increasing size of internal array by 1 1/2. This will result in memory reallocations.
For case of set I got your point. So what we want to do is we have fixed 40 fields which needs to be passed and there are some try blocks where we may not able to add values to it (However, we can add null value in catch block but that's doesn’t look feasible as we have to write 35 times same code). For now we are running our own loop for add 40 null values initially then set them as required. We can downcast it to ArrayList implementation where I can pass ArrayList with null Values directly (I am just trying to avoid any manual code i.e. running for loop for 40 fields). e.g. ArrayList<Object> list= new ArrayList<>(Collections.nCopies(40, null)); Values val=new Values(list); -----Original Message----- From: Nathan Leung [mailto:ncle...@gmail.com] Sent: Saturday, January 02, 2016 9:11 PM To: dev@storm.apache.org Subject: Re: Adding more constructors in Tuple class Is there a use case that requires the first? I thought most people use Values which has a variadic constructor so you know the length already anyways. The second doesn't map cleanly. If you pass a set, how do you order the elements in the tuple? You can just pass your collection as a field in the tuple if that's what you need to do. On Jan 2, 2016 1:44 AM, "Sachin Pasalkar" <sachin_pasal...@symantec.com> wrote: > Hi, > > Can we add some more constructor in backtype.storm.tuple.Values class > which are already present in ArrayList class. Some examples are below > > > public Values(int initialCapacity) { > > super(initialCapacity); > > } > > This will help us in some performance management if we know what size > the list going to be. > > > public Values(Collection<? extends Object> c) { > > super(c); > > } > > > This will allow us the addling predefined list to values instead of > manually iterating over it. We cannot use Values(Object... vals) as it > treat list of element as one element > > > Thanks, > > Sachin > >