java


Time Complexity of get operation on Google Protobuf deserialized repeated object


Let's say we create a proto file with repeated of some data type e.g.
message DocList{
repeated string docId = 1;
}
Now we inserted objects to it's builder object in the following manner:
DocList.Builder docList = new DocList.newBuilder()
docList.addAllDocId(docIDlist); // docIDList is ArrayList<String>
Now we perform the following get operation to retrieve an object at an index.
docList.getDocId(i); // Some index i
I want to know whether this get operation is O(1) or O(n) ?
Protobuf ListValue is backed by the java.util.ArrayList
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
values_ = new java.util.ArrayList<com.google.protobuf.Value>();
mutable_bitField0_ |= 0x00000001;
}
hence it is O(1) for get()
OpenJDK ArrayList
#SuppressWarnings("unchecked")
E elementData(int index) {
return (E) elementData[index];
}

Related Links

Scanner is not reading the whole sentence sentence
Springfox swaggerui -> change the default ui path for swagger ui for spring-mvc
Internal Server Error on PageInfo.json
How to change color of a Window (Problems with Buffer Strategy )
String Format double to 00,00 - Java
Stop Watch program [closed]
Program throwwing java.lang.StringIndexOutOfBounds exception for unkown reason
Cannot find symbol System.console().readInt(); [duplicate]
How to initialize only one column in a 2D-array in java?
Unable to see output of Swing program
Java compiler is not agreed with safety of a generic method call
java - checking the array
Recursive XML Schema Type Validation fails when nested
Execution failed for task ':hVFhirApp:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException:
Android HTTPUrlConnection response returns garbage
java detect window process with high CPU or memory usage

Categories

HOME
google-chrome-extension
multithreading
openlayers
variables
clips
blogger
relative-path
relayjs
syntax
objectgears
jsp-tags
bookshelf.js
gis
installshield
ojdbc
flyway4
upload
communication
nano-server
kentor-authservices
etl
jplayer
remote-access
percona
dynamics-crm-online
ghc
apache-metamodel
reactive-cocoa
samoa
shared-hosting
google-pagespeed
physics-engine
mustache.php
chromium-embedded
format-specifiers
blazemeter
centos6.5
nhapi
opentype
kendo-datasource
sql-server-2012-express
javascriptcore
binary-data
semantic-versioning
data-manipulation
create-table
mozilla
geopositioning
bytecode-manipulation
vxworks
withings
objectlistview
greenrobot-eventbus
squib
sas-visual-analytics
ncalc
dynamic-reports
checkboxlist
sencha-touch-2.3
lowpass-filter
diagnostics
snmptrapd
memory-alignment
pdfclown
cudafy.net
imanage
spring-cache
hittest
lync-client-sdk
specrun
time-and-attendance
fuzzy-search
contact-list
multiple-regression
prettytensor
rvest
apachebench
mutation-observers
fouc
security-testing
wyam
splash
graph-api-explorer
modalpopup
android-imagebutton
mdt
document-classification
google-reader
openexr
reactfx
jboss-weld
android-2.2-froyo
message-driven-bean
back-stack
qt-faststart
plasma
eventlistener
cisco-jtapi
netbeans-6.9
code-cleanup
radcombobox
getresponsestream
photoshop-cs4
boost-smart-ptr
data-acquisition

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App