From 0f425a457365e2829a289142c3dd31f2e8e8954b Mon Sep 17 00:00:00 2001 From: Niket Agrawal Date: Tue, 19 Sep 2023 23:45:25 +0530 Subject: [PATCH] Updated comments --- .../multiple/objecttypes/AlternativeMultipeTypeList.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core-java-modules/core-java-collections-array-list-2/src/main/java/com/baeldung/list/multiple/objecttypes/AlternativeMultipeTypeList.java b/core-java-modules/core-java-collections-array-list-2/src/main/java/com/baeldung/list/multiple/objecttypes/AlternativeMultipeTypeList.java index ddef57e41c..d80f4627d3 100644 --- a/core-java-modules/core-java-collections-array-list-2/src/main/java/com/baeldung/list/multiple/objecttypes/AlternativeMultipeTypeList.java +++ b/core-java-modules/core-java-collections-array-list-2/src/main/java/com/baeldung/list/multiple/objecttypes/AlternativeMultipeTypeList.java @@ -11,22 +11,24 @@ import java.util.function.Predicate; public class AlternativeMultipeTypeList { public static void main(String[] args) { - // List of Numbers + // List of Parent Class ArrayList myList = new ArrayList<>(); myList.add(1.2); myList.add(2); myList.add(-3.5); - // List of Map + // List of Interface type ArrayList diffMapList = new ArrayList<>(); diffMapList.add(new HashMap<>()); diffMapList.add(new TreeMap<>()); diffMapList.add(new LinkedHashMap<>()); + // List of Custom Object ArrayList objList = new ArrayList<>(); objList.add(new CustomObject("obj1", 1)); objList.add(new CustomObject("obj2", 2)); + // List via Functional Interface List dataList = new ArrayList<>(); Predicate myPricate = inputData -> (inputData instanceof String || inputData instanceof Integer);