bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Java/Java Reference
Java•Java Reference

Java LinkedList forEach() Method

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind Java LinkedList forEach() Method?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Order

Put the learning moves in the order that makes the concept easiest to apply.

The forEach() method performs an action on every item in a list.
Definition and Usage
Java LinkedList forEach() Method

❮ LinkedList Methods

LinkedList

Definition and Usage

The forEach() method performs an action on every item in a list. The action can be defined by a lambda expression that is compatible with the accept() method of Java's Consumer interface.

To learn about lambda expressions, see our Java Lambda Expression tutorial .

Syntax

public void forEach(Consumer
action )

Parameter Values

ParameterDescription
actionRequired. A Consumer object or lambda expression which performs an action on an item.

Previous

Java LinkedList contains() Method

Next

Java LinkedList get() Method