Java doesn't have such a thing. Is this by design? If yes, would love to
understand the rationale of why
clearing-everything-and-reinserting-(N-1)-values is so much better than:
(a) providing an API to do so, and
(b) providing a more optimized implementation that is not O(n) on a delete.

Thanks
Dheeraj

On Wed, Jun 23, 2010 at 7:21 AM, Igor Gatis <igorga...@gmail.com> wrote:

> C++ code has the RemoveLast method. If there is such thing in Java, you
> could remove 1 item by shifting everything one position earlier and than
> calling RemoveLast. Batch removal can be also accomplished in the same with
> two counters.
>
>
> On Wed, Jun 23, 2010 at 7:03 AM, Thomas Broyer <t.bro...@gmail.com> wrote:
>
>>
>> On 23 juin, 07:02, Dheeraj <dhee...@gmail.com> wrote:
>> > How do I delete an entry from a list in a protobuf (repeated field)? I
>> > can add, I can modify, but I cannot delete using any of the generated
>> > APIs. A getList() returns an unmodifiable collection.
>>
>> Clear the field and then re-add values. You can also set the field
>> with a List<?> (setField with the FieldDescriptor for your repeated
>> field), which has the same effect.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Protocol Buffers" group.
>> To post to this group, send email to proto...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/protobuf?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to proto...@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to