Unique features of Java 16-4 LinkedList

Source: Internet
Author: User

Know
Unique features of LinkedList:
A: Add Features
public void AddFirst (Object e)
public void AddLast (Object e)
B: Get Features
Public Object GetFirst () gets the first element
Public obejct GetLast () gets the last element
C: Delete function
Public Object Removefirst () deletes the first element
Public Object removelast () deletes the last element

1 Importjava.util.LinkedList;2  Public classLinkedlistdemo {3  Public Static voidMain (string[] args) {4 //To create a collection object5LinkedList link =NewLinkedList ();6 7 //adding elements8Link.add ("Hello");9 //link.addfirst ("Java ee"); wherever it is placed, it will be added to the first place.TenLink.add ("World"); One //link.addlast ("Android"); put it here and add it here. ALink.add ("Java"); -  - //Public void AddFirst (Object e) the //link.addfirst ("Java ee"); - //Public void AddLast (Object e) - //link.addlast ("Android"); -  + //Public Object GetFirst () - //System.out.println ("GetFirst:" + Link.getfirst ()); + //Public obejct GetLast () A //System.out.println ("GetLast:" + link.getlast ()); at  - //Public Object Removefirst () - //System.out.println ("Removefirst:" + Link.removefirst ()); - //Public Object removelast () - //System.out.println ("removelast:" + link.removelast ()); -  in //Output Object Name -System.out.println ("Link:" +link); to } +}

Unique features of Java 16-4 LinkedList

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.