What syntax would I use to get the number of bytes representing a string and compare them to the number of bytes representing an ArrayList
holding that string, for
You can check the size of object after serialization process using Apache Commons as follows:
// Create serialize objects.
final List src = new ArrayList();
src.add("awsome");
src.add("stack");
src.add("overflow");
System.out.println(
"Size after serialization:" + SerializationUtils.serialize((Serializable) src).length);
Output :
Size after serialization:86