[ 
https://issues.apache.org/jira/browse/AVRO-730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12982876#action_12982876
 ] 

Chase Bradford commented on AVRO-730:
-------------------------------------

I had thought about that, but couldn't think of the best way to implement it 
without a large opportunity for odd behavior.

Here are some of the thoughts that went through my mind:

1) Don't do anything.  This would cause a duplicate object reference at 
data[size] and data[size-1], which would be very bad.
2) Set data[size] = removed_object.   The inner array would have only distinct 
elements with no loss of instances.
3) Shift entire array and set data[size-1] = null.  We only lose one object 
instance at the end, which hopefully wouldn't get hit all the time.


2) is the most efficient, but I didn't know what sort of assurances should be 
made about the removed element.  I think most people would assume that once an 
object is removed from a List, regardless of the implementation, then that 
object is safe from modification by the list.


> Implement set and remove methods from List interface on GenericData.Array
> -------------------------------------------------------------------------
>
>                 Key: AVRO-730
>                 URL: https://issues.apache.org/jira/browse/AVRO-730
>             Project: Avro
>          Issue Type: New Feature
>          Components: java
>    Affects Versions: 1.4.1
>            Reporter: Chase Bradford
>            Assignee: Chase Bradford
>             Fix For: 1.5.0
>
>         Attachments: AVRO-730.patch
>
>
> GenericData.Array throws an UnsupportedOperationException when set() or 
> remove() are used on an instance of it.  I think it's reasonable for those 
> methods to work though, since their implementation is simple and inline with 
> most other List types.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to