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

Why does this consumer (running on a servlet) not receive any messages from the kafka topic?
Spring Security 4 appropriate showing logout/session expire message
SendGrid: templates and substitution tags
ClassNotFoundException on connecting MariaDB using Spark
How to iterate multiple data from DAO
Rock Paper Scissor ending loop after 5 wins for either user
Error Creating and connecting to a Socket based server on AWS
java error in 2 different methods: missing return statement
Proper way to subclass a Java AsyncTask for looser coupling [duplicate]
NullPointerException when trying to call JavaFX fxml controller method from another class [duplicate]
Intellij Gradle terminal ERROR: JAVA_HOME is not set
How to check if QueueConnection is closed or active?
Operation not allowed after resultset closed - error [closed]
Floyd-Warshall algorithm - shortest path - save paths index to array
Cannot Compile Spring Boot Project after Update to New Version
How To Search In Listview From Toolbar In Fragment

Categories

HOME
google-chrome-extension
clips
openmp
tizen
dictionary
objectgears
yahoo-oauth
ezpublish
enterprise-library-5
django-imagekit
virtualization
slick-slider
maude-system
tomcat6
fortumo
visual-studio-cordova
flask-wtforms
decomposition
quartz-scheduler
finite-automata
solaris-10
http-status-code-504
interop
abi
bootstrap-tour
javacv
facebook-access-token
kannel
pingfederate
elasticsearch-ruby
socialengine
http-status-code-503
karaf
stringtemplate
repo
ghost4j
force-layout
picasso
android-ble
file-format
stacked
web-mining
gesture
libraries
android-fingerprint-api
cookiecutter-django
ensembles
grid.mvc
firebase-admin
nand2tetris
isbn
gpx
wptoolkit
menuitem
xml-documentation
zip4j
pango
paxos
togetherjs
gabor-filter
recursive-datastructures
tactic
font-size
qtwebview
lync-client-sdk
orthogonal
account-kit
smart-table
watchconnectivity
libpng
bonobo
file-writing
websitepanel
simplewebrtc
prettytensor
bluegiga
wapiti
endeca-workbench
eclipse-clp
mutation-observers
iis-arr
service-accounts
mono-embedding
block-device
rdtsc
terminfo
castle
has-many-through
rebol3
oracle-warehouse-builder
monomac
intentservice
page-layout
geos
dir
coverflow
excel-2003
chronoforms
orchardcms-1.7
pygit2
android-hardware
first-responder
datawindow
assembly-loading
eclipse-templates
horizontal-accordion
lpeg
sudzc
ncqrs
mtj
privilege
temporal-database
commodore

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App