Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

functionality of consumer functional interface in java

package com.zetcode;

import java.util.List;
import java.util.function.Consumer;

public class ConsumerEx3 {

    public static void main(String[] args) {

        var words = List.of("falcon", "wood", "rock", "forest",
                "river", "water");

        words.forEach(new Consumer<String>() {
            @Override
            public void accept(String s) {

                System.out.println(s);
            }
        });
    }
}
Source by zetcode.com #
 
PREVIOUS NEXT
Tagged: #functionality #consumer #functional #interface #java
ADD COMMENT
Topic
Name
3+3 =