I'm having an arraylist which contains object of class X. Class x has property name & desc. When I pass this object to a method, it needs to set all class object(X) description as 'MyDescription'. What is the best way to do it.
For eg
class X{
String name;
String desc="Hello";
//We have getters & setters too.
}
ArrayList<X> obj=getArraylist();
Now we got say 10 object of class X in obj. I need to reset all its description to 'MyDescription'
Can I do without looping into each object and reset its value? Please suggest.
As string is immutable, can we do something. – MukeshKoshyM Jun 13 '13 at 18:27