Thank you for the reply. You are right. The function used to initially get the 
set returns an unmodifiableSet. That is the reason for the error.
However, when we use a Map as a field and initially write an unmodifiableMap, 
we can still modify the Map using getField. 

The code is like how we use the Set: 

BinaryObjectBuilder boBuilder = bo.toBuilder();
Map<String, String> meta = boBuilder.getField(meta_FieldStr);
meta.put(key, value);
boBuilder.setField(meta_FieldStr, meta, Map.class);

What is the difference between Map and Set here?

Thanks,
Cong

-----Original Message-----
From: vkulichenko [mailto:valentin.kuliche...@gmail.com] 
Sent: 2018年7月23日 17:16
To: user@ignite.apache.org
Subject: Re: UnsupportedOperationException when updating a field in binary 
object

This test stops working though if you replace line 30 with this:

builder.setField("set", Collections.unmodifiableSet(Sets.newHashSet("a",
"b", "c")));

If unmodifiable set is written, it's then read as unmodifiable set as well, and 
therefore can't be modified. I believe this is the reason for the error.

-Val



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to