Search code examples
javalistindexingdata-structurescisco

Shouldn't the startIndex be one?


I am doing a tutorial on how to use the Cisco APIC EM Reference API Here is where I currently am in the tutorial

enter image description here

Here is the actual API Documentation for that method - from the APIC-EM API Docs.

enter image description here

To get a list of the first 3 hosts, the tutorial specified a start index of 1.

Off just reading the API documentation, how would you know that the first element(host) is at index 1, not 0? In Java, indexed based structures like List(ArrayList, LinkedList) are zero indexed. Is it different when working with APIs?


Solution

  • Usually it is zero based, however there are exceptions and they are explicitly stated in the documentation. The only solution without documentation is the old trial and error method.