Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8490845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:14:40+00:00 2026-06-10T22:14:40+00:00

I have an object containing a list sent from a C# client to a

  • 0

I have an object containing a list sent from a C# client to a Java server. The serialization with protobuf work perfectly and the object is received perfectly in Java. But the class generated with protoc.exe (can we call it a proto class?) have a list that i can’t modify. Basically, I have to add some values in it before returning it to C#, but when I try to add a value, i have an exception :

Exception in thread "main" java.lang.UnsupportedOperationException
    at java.util.AbstractList.add(AbstractList.java:148)
    at java.util.AbstractList.add(AbstractList.java:108)
    ...

Here’s how i’m adding values:

MyProtoObject.MyResult result = MyProtoObject.MyResut.NewBuilder()
        .setId(1)
        .setValue(9.135)
        .build();
MyObject.getResultList().add(result);

How can i insert values in it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T22:14:41+00:00Added an answer on June 10, 2026 at 10:14 pm

    Ok after regenerating the proto class, it appears some methods was missing (I probably made mistakes in first generation). So now i can add values in the list :

    MyObjectProto.MyObject o = MyObjectProto.MyObject.newBuilder()
        .addAllResults(listOfCalculations)
        .build();
    

    listOfCalculation is a List of results objects

    or just :

    MyObjectProto.MyObject o = MyObjectProto.MyObject.newBuilder()
        .addResult(calculationResult)
        .build();
    

    CalculationResult is a single result object

    Thanks to Flavio

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a work-space object containing a list of target objects with their properties.
Assuming I have an object A containing // ... private List<double> someList = new
I have a ResultSet object containing all the rows returned from an sql query.
I have a ViewModel that have a list object containing other list objects and
I have a backing bean containing this object: List<Session> sessions; and a Session is
Let's say I have List of object containing these two records : EmployeeId -
I have a simple Repeater Bound to a List of Objects, the object containing
I have a webservice ( RestEasy ) returning a JSON object containing a List<..>
I have a stl::list containing Widget class objects. They need to be sorted according
The problem is: I have a list of objects, with some containing the same

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.