In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
The main content of this article is to explain "what is the List interface", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is the List interface"?
List interface
List is a subinterface of Collection, and its most important feature is that it allows the storage of duplicate element data. The definition of this interface is as follows:
Public interface List extends Collection
But what needs to be clear is that the list subinterface extends the method of the Collection interface.
No. Method name type description 01public E get (int index) General get data on the specified index 02public E set (int index, E element) ordinary modification specified index data 03public ListIterator listIterator () ordinary return ListIterator interface object
But List itself still belongs to an interface, so if you want to use an interface, you must use subclasses to complete the definition. There are three common subclasses in the list subinterface: ArrayList, Vector, and LinkedList.
List subinterface
Starting from JDK1.9, some static methods are appended to the List interface to facilitate user processing.
Example: static method of observing List
Import java.util.Arrays;import java.util.List;public class JavaAPIDemo {public static void main (String [] args) throws Exception {List all = List.of ("Hello", "World", "Hello", "MLDN", "ele.me?") ; Object result [] = all.toArray (); for (Object temp: result) {System.out.println (temp + ","); / / [Hello, World, Hello, MLDN, ele.me?] At this point, I believe you have a deeper understanding of "what is the List interface". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.