Java.util.LinkedList.removeFirstOccurrence() 方法 Java.util.LinkedList.removeFirst() 方法 Java.util.LinkedList.removeLast() 方法 Java.util.LinkedList.removeFirstOccurrence() 方法 package com.codingdict; import java.util.*; public class LinkedListDemo { public static void main(String[] args) { // create a LinkedList LinkedList list = new LinkedList(); // add some elements list.add("Hello"); list.add(2); list.add("Chocolate"); list.add("10"); list.add("Hello"); // print the list System.out.println("LinkedList:" + list); // remove the first "Hello" boolean found = list.removeFirstOccurrence("Hello"); System.out.println("Element found:" + found); // print the list System.out.println("LinkedList:" + list); } } Java.util.LinkedList.removeFirst() 方法 Java.util.LinkedList.removeLast() 方法