java - Do ArrayLists that contain different types of objects use different amounts of memory? -
for example, if have
    int a=2; int b=3;     arraylist<integer>integers=new arraylist<integer>();     integers.add(a); integers.add(b);   and
    string c="cow"; string d="deer";     arraylist<string> strings= new arraylist<string>();     strings.add(c); strings.add(d);   would take different amounts of memory? help/answer highly appreciated, thanks!
the arraylists nothing more collection of references, , these take same amount of memory (if same size) no matter type of objects hold. items referred arraylist take differing amounts of memory expect.
Comments
Post a Comment