Home > Java > javaTutorial > What does index mean in java?

What does index mean in java?

little bottle
Release: 2019-05-22 13:36:52
Original
21353 people have browsed it

Java is an object-oriented language. Java has many classes, among which the word index is included in the List class of Java. A friend asked what it means and what it does. Does it have anything to do with indexing?

What does index mean in java?

#There is an index in Java's List class, and the value in the list can be obtained through the index, which is an integer value.

You can return the index of the object in the list through indexOf(object o).

Usage of Indexof in List (determining whether it exists)

string str = "aa";
ArrayList list = new ArrayList();
list.Add("bb");
list.Add("aa");
list.Add("cc");
if (list.IndexOf(str) == -1)
{
list.Add(str);
}
Copy after login

The above is the detailed content of What does index mean in java?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template