Hi All,
Properties props;
Properties props_;
props_.putAll(props);
I want to copy all properties from "props" object to "props_".But it
fails to copy all values.
Please can any one tell me the reason ?
Thanks.
Manish Pandit - 06 Dec 2007 05:59 GMT
> Hi All,
>
[quoted text clipped - 8 lines]
>
> Thanks.
Are you sure props is not empty? I wrote a little snippet to check it
out:
Properties p = new Properties();
p.put("A","a");
p.put("B","b");
Properties copy = new Properties();
copy.putAll(p);
System.out.println(p);
System.out.println(copy);
And here is the output:
{A=a, B=b}
{A=a, B=b}
-cheers,
Manish
Daniele Futtorovic - 06 Dec 2007 22:45 GMT
> Hi All,
>
[quoted text clipped - 6 lines]
> fails to copy all values.
> Please can any one tell me the reason ?
Possibly because of the defaults. putAll(Map) will iterate the source. I
don't see entrySet() or the like overridden in Properties, so it will be
Hashtable's version, which won't include the defaults.
DF.
Lew - 07 Dec 2007 03:08 GMT
>> Hi All,
>>
[quoted text clipped - 10 lines]
> don't see entrySet() or the like overridden in Properties, so it will be
> Hashtable's version, which won't include the defaults.
Maybe there's some help to be had from
<http://java.sun.com/javase/6/docs/api/java/util/Properties.html#Properties(java.
util.Properties)>

Signature
Lew