Joining two different generic type of ArrayList.
Hi!There is a question! I want to combine:
List<String> string=new ArrayList<String>(); and List<Integer> numbers=new ArrayList<Integer>();
And the new ArrayList should have both elements in one index as :
index--->(string.get(0),numbers.get(o))--->("Many many thanks for your help",6)
So, then I could sort by numbers it would have.
I tried to use Hashtable but as its key unique,it doesn't work for me. Is it possible to merge in this way? Or not?:confused:
Re: Joining two different generic type of ArrayList.
Sounds like you need to have a custom class that holds a String and number and some methods for accessing it contents and sorting. Instances of that class could be put in an ArrayList<YourCustomClass>